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

Nested @time and @profile with closure gives syntax error #13229

Closed
KristofferC opened this issue Sep 19, 2015 · 3 comments
Closed

Nested @time and @profile with closure gives syntax error #13229

KristofferC opened this issue Sep 19, 2015 · 3 comments
Assignees
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage) help wanted Indicates that a maintainer wants help on an issue or pull request

Comments

@KristofferC
Copy link
Member

@time @profile for i = 1:5
    function f(x)
        return x + i
    end
    f(i)
end

gives

ERROR: syntax: misplaced return statement

Removing the return statement or any of the macros makes it run as expected. Maybe it is wrong to chain macros like this? Reversing the macros also works.

@ihnorton
Copy link
Member

ihnorton commented Oct 2, 2015

Dupe of #1784

@ihnorton ihnorton closed this as completed Oct 2, 2015
@ihnorton ihnorton reopened this Oct 17, 2015
@ihnorton ihnorton added compiler:lowering Syntax lowering (compiler front end, 2nd stage) help wanted Indicates that a maintainer wants help on an issue or pull request labels Oct 17, 2015
@ihnorton ihnorton self-assigned this Oct 17, 2015
@ihnorton
Copy link
Member

This is actually somewhat distinct from #1784. We need to improve the hasbreak condition in the try expander to exclude function definitions.

ihnorton added a commit to ihnorton/julia that referenced this issue Feb 20, 2016
@ihnorton
Copy link
Member

This appears to be fixed (presumably by jb/functions?). Test in #15159.

ihnorton added a commit that referenced this issue Feb 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:lowering Syntax lowering (compiler front end, 2nd stage) help wanted Indicates that a maintainer wants help on an issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants