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

Syntactic error in one-liner definition of generated functions with where syntax #22135

Closed
giordano opened this issue May 30, 2017 · 0 comments · Fixed by #22166
Closed

Syntactic error in one-liner definition of generated functions with where syntax #22135

giordano opened this issue May 30, 2017 · 0 comments · Fixed by #22166
Assignees
Labels
kind:bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@giordano
Copy link
Contributor

julia> @generated foo(x::T) where T = x
ERROR: invalid syntax; @generated must be used with a function definition

julia> @generated foo(x::T where T) = x
foo (generic function with 1 method)

julia> @inline foo(x::T) where T = x
foo (generic function with 1 method)

julia> @fastmath foo(x::T) where T = x
foo (generic function with 1 method)

Is there a particular reason why the first definition is a syntactic error?

First reported at https://discourse.julialang.org/t/one-liner-definition-of-generated-functions-with-where-syntax/3982

@JeffBezanson JeffBezanson added the kind:bug Indicates an unexpected problem or unintended behavior label May 31, 2017
@JeffBezanson JeffBezanson added this to the 0.6.x milestone May 31, 2017
@JeffBezanson JeffBezanson self-assigned this May 31, 2017
JeffBezanson added a commit that referenced this issue May 31, 2017
JeffBezanson added a commit that referenced this issue Jun 1, 2017
JeffBezanson added a commit that referenced this issue Jun 1, 2017
JeffBezanson added a commit that referenced this issue Jun 1, 2017
tkelman pushed a commit that referenced this issue Jun 3, 2017
fixes #22135, fixes #22122, fixes #22026, fixes #21581, fixes #16096, fixes #19351

(cherry picked from commit 60675d2)
ref #22166
@rfourquet rfourquet changed the title Syntactic erorr in one-liner definition of generated functions with where syntax Syntactic error in one-liner definition of generated functions with where syntax Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants