-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Test return
as expression
#15548
Test return
as expression
#15548
Conversation
3cf8498
to
6ff724d
Compare
needs end-of-file rebase but lgtm |
6ff724d
to
ea8c89e
Compare
|
||
# issue #11169 | ||
@test_throws UndefVarError undefvar | ||
let undefvar = return 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.
This is a bit sketchy --- it's not clear we should even allow return
without any obvious enclosing function. Also since this is a let
, it wouldn't lead to undefvar
being defined globally anyway. Maybe we should test f(return)
and confirm that f
wasn't called (via a side effect)?
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.
I think this should succeed:
uncalled(x) = @test false
fret() = uncalled(return true; @test false)
@test fret()
Alas it doesn't; the @test false
after the return true
is executed. This looks like a bug to me.
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.
Yes I think you're right. I believe this is #9535.
53dad23
to
edf5ba1
Compare
@JeffBezanson I simplified the test -- nothing about argument order any more. LGTY? |
Test `return` as expression
Closes #11169.