-
Notifications
You must be signed in to change notification settings - Fork 50
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
Reduces JET errors #359
Merged
Merged
Reduces JET errors #359
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,15 @@ function row_limit(str, limit=50) | |
end | ||
|
||
digits_subchars = collect("₀₁₂₃₄₅₆₇₈₉") | ||
digits_substr(n,nwidth) = join(([digits_subchars[d+1] for d in reverse(digits(n, pad=nwidth))])) | ||
function digits_substr(n::Integer, nwidth::Int) | ||
dlist = digits(n, base=10, pad=nwidth) | ||
for d in dlist | ||
if d < 0 || d > 9 | ||
throw(BoundsError("Digits out of range: $d")) | ||
end | ||
end | ||
return join([digits_subchars[d+1] for d in reverse(dlist)]) | ||
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. this does not seem to affect the number of jet warnings for me |
||
|
||
function Base.copy(c::CliffordOperator) | ||
CliffordOperator(copy(c.tab)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,11 @@ julia> make_variant(sCNOT) | |
``` | ||
""" | ||
function make_variant(type::Union{DataType,SymbolicDataType}) | ||
Expr(:call, _symbol(type), [:(::$t) for t in _types(type)]...) | ||
variant_args = [] | ||
for t in _types(type) | ||
push!(variant_args, :(::$t)) | ||
end | ||
Expr(:call, _symbol(type), variant_args...) | ||
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. This does not seem to affect the number of JET warnings in my tests. Why is it needed? |
||
end | ||
|
||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
@testitem "JET checks" tags=[:jet] begin | ||
using JET | ||
using ArrayInterface | ||
using Static | ||
using Graphs | ||
using StridedViews | ||
using LinearAlgebra | ||
using JET | ||
using Test | ||
using ArrayInterface | ||
using Static | ||
using Graphs | ||
using StridedViews | ||
using LinearAlgebra | ||
|
||
rep = report_package("QuantumClifford"; | ||
ignored_modules=( | ||
AnyFrameModule(Graphs.LinAlg), | ||
AnyFrameModule(Graphs.SimpleGraphs), | ||
AnyFrameModule(ArrayInterface), | ||
AnyFrameModule(Static), | ||
AnyFrameModule(StridedViews), | ||
AnyFrameModule(LinearAlgebra), | ||
) | ||
) | ||
@show rep | ||
@test_broken length(JET.get_reports(rep)) == 0 | ||
@test length(JET.get_reports(rep)) <= 23 | ||
rep = report_package("QuantumClifford"; | ||
ignored_modules=( | ||
AnyFrameModule(Graphs.LinAlg), | ||
AnyFrameModule(Graphs.SimpleGraphs), | ||
AnyFrameModule(ArrayInterface), | ||
AnyFrameModule(Static), | ||
AnyFrameModule(StridedViews), | ||
AnyFrameModule(LinearAlgebra), | ||
)) | ||
|
||
@show rep | ||
@test_broken length(JET.get_reports(rep)) == 0 | ||
@test length(JET.get_reports(rep)) <= 15 | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These cause stack overflow errors as they are referring to themselves:
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.
they would need tests