Skip to content

False positive warning about "returning an abrupt completion" #619

@Jack-Works

Description

@Jack-Works

it warns for the following code after upgrading from 19.1.0 to 20.0.0. It uses ReturnIfAbrupt.

Warning: spec.emu: this algorithm is declared as returning an abrupt completion, but there is no step which might plausibly return an abrupt completion

<emu-clause id="sec-iterator-step-cached" type="abstract operation">
    <h1>
    IteratorStepCached (
        _iterator_: an Iterator Record,
        _cacheGroup_: a %Map%,
    ): either a normal completion containing either an ECMAScript language value or ~not-matched~, or an abrupt completion
    </h1>
    <dl class="header">
    </dl>
    <emu-alg>
    1. Assert: _cacheGroup_ is created by CreateMatchCache and used internally for pattern-matching.
    1. If _iterator_.[[Done]] is *true*, return ~not-matched~.
    1. Let _cache_ be GetMatchCache(_iterator_, _cacheGroup_).
    1. Let _iteratedValues_ be ! Get(_cache_, *"IteratedValues"*).
    1. Let _iteratorResult_ be Completion(IteratorStep(_iterator_)).
    1. If _iteratorResult_ is an abrupt completion, set _iterator_.[[Done]] to *true*.
    1. ReturnIfAbrupt(_iteratorResult_).
    1. If _iteratorResult_ is *false*, then
        1. Set _iterator_.[[Done]] to *true*.
        1. Return ~not-matched~.
    1. Let _value_ be Completion(IteratorValue(_iteratorResult_)).
    1. If _value_ is an abrupt completion, set _iterator_.[[Done]] to *true*.
    1. ReturnIfAbrupt(_value_).
    1. Perform ! Call(<emu-xref href="#sec-array.prototype.push">%Array.prototype.push%</emu-xref>, _iteratedValues_, « _value_ »).
    1. Return _value_.
    </emu-alg>
</emu-clause>

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