Skip to content

Investigate terminate state after infinite loop with return #1138

Closed
@dcodeIO

Description

@dcodeIO

While working on #1129 I noticed that code like the following still wants a return statement

  get file(): File {
    var current: Element = this;
    do {
      current = current.parent;
      if (current.kind == ElementKind.FILE) return <File>current;
    } while (true);
    return <File>unreachable(); // here
  }

not noticing that control flow cannot actually fall through. Pinning here so we don't forget.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions