Skip to content

Implicit return with case expression fails with 'var' return. #3339

Closed
@dom96

Description

@dom96
type
  Foo = ref object
    x: seq[string]

proc get_x(x: Foo): var seq[string] =
  case true
  of true:
    x.x
  else:
    x.x

var foo = Foo(x: @[])
foo.get_x().add("asd")

Error:

Error: expression has no address

Works when explicitly using return.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationRelated to documentation content (not generation).Low Priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions