Skip to content

try expression doesn't work with return on expect branch #13490

Closed
@alaviss

Description

@alaviss

Example

func bar: string = ""

func foo() =
  let input =
    try:
      bar()
    except:
      return

Current Output

test.nim(6, 10) Error: expression 'bar()' is of type 'string' and has to be discarded

Expected Output

Additional Information

$ nim -v
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2020-02-24
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 3dad130034e3212159dda5d61988ca2b18959b24
active boot switches: -d:release -d:useLinenoise -d:nativeStackTrace

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions