Skip to content

@return directive does not cause function to exit #736

@lunelson

Description

@lunelson

This bug reported started with a question on twitter; I've been able to narrow the test case to the following, but it's still unclear whether it might have to do with the @each and/or @if directive parsing. In any case, in the test calls of the function, all three should return 'found true' but only the third one does. In the first two, the first @return directive is either not being seen or in any case it's not causing the function to exit.

@function contains-true($list) {
  @each $bool in $list {
    @if $bool {
      @return 'found true';
    }
  }
  @return 'nothing found';
}

.test {
  out: contains-true(true false false);
  out: contains-true(false true false);
  out: contains-true(false false true);
}
.test {
  out: 'nothing found';
  out: 'nothing found';
  out: 'found true'; }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions