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

Assertion failure for example blocks with comments #1655

Closed
schillic opened this issue Jul 21, 2021 · 4 comments
Closed

Assertion failure for example blocks with comments #1655

schillic opened this issue Jul 21, 2021 · 4 comments
Assignees
Milestone

Comments

@schillic
Copy link
Contributor

#1634 brought a new assertion

@assert length(exs) == 2 * length(results)

that does not seem to always hold. It failed in JuliaReach/LazySets.jl#2792 in a case with comments in an @example block. After removing the comments it worked. Below is the example.

```@example set_operations
println(is_intersection_empty(BI, H))
w1 = is_intersection_empty(BI, H, true)[2]
# none of the other combinations are supported yet
# is_intersection_empty(B1, B2)
# is_intersection_empty(B1, BI)
# is_intersection_empty(B1, H)
# w2 = is_intersection_empty(B1, H, true)[2]
# is_intersection_empty(B2, BI)
# is_intersection_empty(B2, H)
```

Printing the output of the vectors before the assertion fails yields:

# length == 4
exs = Any[
:(#= set_operations.md:1 =#),
:(println(is_intersection_empty(BI, H))),
:(#= set_operations.md:2 =#),
:(w1 = (is_intersection_empty(BI, H, true))[2])
]

# length == 3
results = Any[(
(:(println(is_intersection_empty(BI, H))), "println(is_intersection_empty(BI, H))\n"),
(:(w1 = (is_intersection_empty(BI, H, true))[2]), "w1 = is_intersection_empty(BI, H, true)[2]\n"),
(nothing, "# none of the other combinations are supported yet\n# is_intersection_empty(B1, B2)\n# is_intersection_empty(B1, BI)\n# is_intersection_empty(B1, H)\n# w2 = is_intersection_empty(B1, H, true)[2]\n# is_intersection_empty(B2, BI)\n# is_intersection_empty(B2, H)\n")
]

So it seems that comments are not assigned a line number, but they still occur in the results vector.

@fredrikekre
Copy link
Member

Sorry about that. As you probably figured out you can use 0.27.3 for now, but I will try to fix it soon.

@schillic
Copy link
Contributor Author

No pressure, we just removed the comments. Just wanted to report.

@t-bltg
Copy link
Contributor

t-bltg commented Jul 21, 2021

I've also hit that in https://github.com/JuliaPlots/PlotDocs.jl/blob/master/docs/src/animations.md, you can also use nothing # hide as last statement:

println(is_intersection_empty(BI, H))
w1 = is_intersection_empty(BI, H, true)[2]
# none of the other combinations are supported yet
# is_intersection_empty(B1, B2)
# is_intersection_empty(B1, BI)
# is_intersection_empty(B1, H)
# w2 = is_intersection_empty(B1, H, true)[2]
# is_intersection_empty(B2, BI)
# is_intersection_empty(B2, H)
nothing # hide

@schillic
Copy link
Contributor Author

Thanks for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants