-
Notifications
You must be signed in to change notification settings - Fork 21
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
Syntax error when using @NamedTuple
types inside resumable function
#104
Comments
Can you try with #100? |
This comment was marked as outdated.
This comment was marked as outdated.
Correcting my previous message: julia> @resumable function bar()
foo = "unused"
vec = (foo = 3,)::@NamedTuple{foo::Int64}
@yield vec
end
julia> @resumable function bar2()
foo = "unused"
vec = @NamedTuple{foo::Int64}((foo = 3,))
@yield vec
end
julia> collect(bar())
ERROR: TypeError: in Type, in parameter, expected Type, got a value of type Tuple{Expr}
Stacktrace:
[1] ##bar_FSMI#230
@ ~/.julia/packages/ResumableFunctions/IOa5O/src/macro.jl:3 [inlined]
[2] ##bar_FSMI#230
@ ~/.julia/packages/ResumableFunctions/IOa5O/src/macro.jl:166 [inlined]
[3] iterate (repeats 2 times)
@ ~/.julia/packages/ResumableFunctions/IOa5O/src/types.jl:24 [inlined]
[4] _collect(cont::UnitRange{Int64}, itr::var"##bar_FSMI#230"{Union{}, String}, ::Base.HasEltype, isz::Base.SizeUnknown)
@ Base ./array.jl:770
[5] collect(itr::var"##bar_FSMI#230"{Union{}, String})
@ Base ./array.jl:759
[6] top-level scope
@ REPL[8]:1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the problem
One cannot use the
@NamedTuple
syntax (introduced in julia 1.5) inside a@resumable
function, if one of the keys of the named tuple is also present as a local variable of that function.I expect the
@NamedTuple{foo::Int64}
syntax in the mwe below to be equivalent to replacing it byBase.NamedTuple{(:foo,), Base.Tuple{Int64}}
. However, the latter works as expected, but the former throwsERROR: syntax: invalid named tuple field name "_fsmi.foo" around REPL[26]:2
.Minimal Working Example
Package versions
Please provide the versions you use. To do this, run the code:
The text was updated successfully, but these errors were encountered: