Skip to content
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

Edge cases for empty ProductSpaces #102

Closed
lkdvos opened this issue Jan 26, 2024 · 1 comment
Closed

Edge cases for empty ProductSpaces #102

lkdvos opened this issue Jan 26, 2024 · 1 comment

Comments

@lkdvos
Copy link
Collaborator

lkdvos commented Jan 26, 2024

The following throws an error:

julia> blockdim(ComplexSpace(2), Trivial())
2

julia> blockdim(one(ComplexSpace(2)), Trivial())
ERROR: MethodError: no method matching fusiontrees(::Tuple{}, ::Trivial)

Closest candidates are:
  fusiontrees(::Tuple{Vararg{I, N}}, ::I, ::Tuple{Vararg{Bool, N}}) where {N, I<:Sector}
   @ TensorKit ~/Projects/People/Sylvain/dev/TensorKit/src/fusiontrees/iterator.jl:4
  fusiontrees(::Tuple{I, Vararg{I}}, ::I) where I<:Sector
   @ TensorKit ~/Projects/People/Sylvain/dev/TensorKit/src/fusiontrees/iterator.jl:8

Stacktrace:
 [1] blockdim(P::ProductSpace{ComplexSpace, 0}, c::Trivial)
   @ TensorKit ~/Projects/People/Sylvain/dev/TensorKit/src/spaces/productspace.jl:182

Similar results for graded spaces etc. It seems like this was introduced in 9ad2804, and is fixed by just replacing Tuple{I,Vararg{I}} with Tuple{Vararg{I}} in this line. I think this got introduced because Aqua was complaining?

@Jutho
Copy link
Owner

Jutho commented Jan 26, 2024

Ok that's bad cause this is probably causing actual bugs. We should test against this. I made that change to make Aqua.jl happy, so I'll have to rethink this. The complaint of Aqua was that in principle the old definition allows for a function call that does not enable to infer I, namely if the first argument is an empty tuple and the second is not specified, relying on the default value (which cannot be determined anyway for an empty tuple). So we should split out specifying the default value of the second argument.

@lkdvos lkdvos closed this as completed Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants