Skip to content

Commit

Permalink
[WGSL] Break-if should not have a type
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=268461
rdar://121527180

Reviewed by Mike Wyrzykowski.

We get an assertion failure due to the typeError call from validating the
test expression in break-if statements leaves an inferred bottom type, when
statements (including break-if) should not have an inferred type.

* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::visit):

Canonical link: https://commits.webkit.org/273910@main
  • Loading branch information
tadeuzagallo committed Feb 1, 2024
1 parent ec49373 commit 40dacda
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/WebGPU/WGSL/TypeCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ void TypeChecker::visit(AST::Continuing& continuing)
if (auto* breakIf = continuing.breakIf) {
auto* type = infer(*breakIf);
if (!unify(m_types.boolType(), type))
typeError(breakIf->span(), "expected 'bool', found ", *type);
typeError(InferBottom::No, breakIf->span(), "expected 'bool', found ", *type);
}
}

Expand Down

0 comments on commit 40dacda

Please sign in to comment.