# One-liner definition of generated functions with where syntax

**URL:** <https://discourse.julialang.org/t/one-liner-definition-of-generated-functions-with-where-syntax/3982>\
**Category:** General Usage\
**Created:** [May 29, 2017, 10:29pm UTC](https://discourse.julialang.org/t/one-liner-definition-of-generated-functions-with-where-syntax/3982 "2017-05-29T22:29:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [May 29, 2017, 10:29pm UTC](https://discourse.julialang.org/t/one-liner-definition-of-generated-functions-with-where-syntax/3982/1 "2017-05-29T22:29:33Z")

</div>

Is there a particular reason why the first definition doesn’t work?

```julia
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)

```

Is this a bug or a feature? I’m running Julia 0.7.0-DEV.363 (Commit 6071f1a02e).

`@inline` decorator instead works (I know that this defines a different function, I’m just showing the different behavior):

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

```

**Edit** : reported on GitHub at [https://github.com/JuliaLang/julia/issues/22135](https://github.com/JuliaLang/julia/issues/22135)

**Edit 2** : fixed, together with a bunch of other bugs, with [https://github.com/JuliaLang/julia/pull/22166](https://github.com/JuliaLang/julia/pull/22166)
