Skip to content

Support abstractfloat track numbers #1300

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Preferences = "1.4"
PythonCall = "0.9"
Random = "1.10"
Random123 = "1.7"
ReactantCore = "0.1.9"
ReactantCore = "0.1.9, 0.1.10"
Reactant_jll = "0.0.185"
ScopedValues = "1.3.0"
Scratch = "1.2"
Expand Down
2 changes: 1 addition & 1 deletion lib/ReactantCore/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ReactantCore"
uuid = "a3311ec8-5e00-46d5-b541-4f83e724a433"
authors = ["William Moses <[email protected]>", "Valentin Churavy <[email protected]>", "Sergio Sánchez Ramírez <[email protected]>", "Paul Berg <[email protected]>", "Avik Pal <[email protected]>"]
version = "0.1.9"
version = "0.1.10"

[deps]
ExpressionExplorer = "21656369-7473-754a-2065-74616d696c43"
Expand Down
10 changes: 8 additions & 2 deletions lib/ReactantCore/src/ReactantCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,25 @@ end
```
"""
macro trace(args...)
track_numbers = true
track_numbers = Number
expr = first(args)
if length(args) > 1 && Meta.isexpr(args[1], :(=))
tn_expr = args[1]
tn_expr.args[1] == :track_numbers ||
error("@trace supports setting track_numbers, but got $(tn_expr)")

track_numbers = tn_expr.args[2]
if track_numbers isa Bool
track_numbers = track_numbers ? Number : Union{}
elseif track_numbers == :AbstractFloat
track_numbers = AbstractFloat
else
error("Unknown argument for track_numbers, got $(track_numbers)")
end
expr = only(args[2:end])
else
expr = only(args)
end
track_numbers = track_numbers ? Number : Union{}
expr = macroexpand(__module__, expr)

if Meta.isexpr(expr, :(=))
Expand Down
Loading