Skip to content

Syntax error when using @NamedTuple types inside resumable function #104

Description

@lgoettgens

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 by Base.NamedTuple{(:foo,), Base.Tuple{Int64}}. However, the latter works as expected, but the former throws ERROR: syntax: invalid named tuple field name "_fsmi.foo" around REPL[26]:2.

Minimal Working Example

@resumable function bar()
   vec = (foo = 3,)::@NamedTuple{foo::Int64}
  foo = "unused"
  @yield vec
end
@resumable function bar2()
  vec = @NamedTuple{foo::Int64}((foo = 3,))
  foo = "unused"
  @yield vec
end

Package versions

Please provide the versions you use. To do this, run the code:

julia> Pkg.status(["ResumableFunctions"]; mode = PKGMODE_MANIFEST)
Status `/tmp/jl_MokoyF/Manifest.toml`
  [c5292f4c] ResumableFunctions v0.6.10

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions