-
Notifications
You must be signed in to change notification settings - Fork 36
[Merged by Bors] - Hotfixes after #309 #351
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
Changes from 9 commits
ecf1e5d
917334b
29d692a
73962ad
9ee336b
ce0a3e8
59303d7
274aebb
ef0faa5
9ecb939
c4e91a0
9b32797
ad049c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,17 +212,23 @@ function submodel(prefix_expr, expr, ctx=esc(:__context__)) | |
if prefix_left !== :prefix | ||
error("$(prefix_left) is not a valid kwarg") | ||
end | ||
|
||
# The user expects `@submodel ...` to return the | ||
# return-value of the `...`, hence we need to capture | ||
# the return-value and handle it correctly. | ||
@gensym retval | ||
|
||
# `prefix=false` => don't prefix, i.e. do nothing to `ctx`. | ||
# `prefix=true` => automatically determine prefix. | ||
# `prefix=...` => use it. | ||
args_assign = getargs_assignment(expr) | ||
return if args_assign === nothing | ||
ctx = prefix_submodel_context(prefix, ctx) | ||
# In this case we only want to get the `__varinfo__`. | ||
quote | ||
$(esc(:__varinfo__)) = last( | ||
$(DynamicPPL._evaluate!!)($(esc(expr)), $(esc(:__varinfo__)), $(ctx)) | ||
$retval, $(esc(:__varinfo__)) = $(DynamicPPL._evaluate!!)( | ||
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. I like returning both the
Following this view, we no longer need to concern ourselves what is the semantics if the returned value 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. I'm a bit confused. In both those cases we still have to concern ourselves with the return-value, no? Essentially the difference between Anyways, you're happy with this right? You're just talking about potentially also supporting 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. yes, happy with this PR. I think |
||
$(esc(expr)), $(esc(:__varinfo__)), $(ctx) | ||
) | ||
$retval | ||
end | ||
else | ||
L, R = args_assign | ||
|
@@ -235,9 +241,10 @@ function submodel(prefix_expr, expr, ctx=esc(:__context__)) | |
) | ||
end | ||
quote | ||
$(esc(L)), $(esc(:__varinfo__)) = $(DynamicPPL._evaluate!!)( | ||
$retval, $(esc(:__varinfo__)) = $(DynamicPPL._evaluate!!)( | ||
$(esc(R)), $(esc(:__varinfo__)), $(ctx) | ||
) | ||
$(esc(L)) = $retval | ||
end | ||
end | ||
end |
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.
Maybe just use
? And it seems you forgot to update test/runtests.jl?
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.
Is this correct though? Don't we want to match at least one
LoadError
?Ah thanks!
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.
+
matches one or more occurrences so it doesn't match only"ERROR: "
:Uh oh!
There was an error while loading. Please reload this page.
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.
Haha, yeah I knew that, hence why I used
?
on the second one. Now you might ask "then why did you just say what you just did?", to which I don't have a good answer 🙃 Thanks man!EDIT: Oh wait, now I remember why I did it! If you do
(LoadError:\s)+
you'll end up comparing the output toError:
, no? While we want to compare it toError: LoadError:
, i.e. all the redundantLoadError:
removed?|EDIT 2: Nope:) I guess it removes it from both the expected output and the actual output then.
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.
The doctest filters will be applied to both the expected output and the actual output and then the matches will be removed. The remaining string is checked for equality. So the LoadError: will be removed from the expected output as well.
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.
https://juliadocs.github.io/Documenter.jl/stable/man/doctests/#Filtering-Doctests
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.
That was my original understanding when I wrote it, but I think I must have missed some whitespace so it didn't match but instead complained that "ERROR: ...
ddin't match
ERROR: LoadError: ...`, i.e. the display seemed to indicate it was only removed from the expected output which confused me.What I've learned tonight: I should not let myself be so easily swayed by displayed information:)