tint/resolver: Fix ICE on short-name type used as identifier.
Bug: chromium:1404922 Change-Id: I47a8a294ba62b034feba98566098bef2246a0c9f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116281 Auto-Submit: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
2ddf02d789
commit
cf1f4658ae
|
@ -2716,11 +2716,13 @@ sem::Expression* Resolver::Identifier(const ast::IdentifierExpression* expr) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (sem_.ResolvedSymbol<type::Type>(expr)) {
|
||||
if (sem_.ResolvedSymbol<type::Type>(expr) ||
|
||||
type::ParseShortName(builder_->Symbols().NameFor(symbol)) != type::ShortName::kUndefined) {
|
||||
AddError("missing '(' for type initializer or cast", expr->source.End());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// The dependency graph should have errored on this unresolved identifier before reaching here.
|
||||
TINT_ICE(Resolver, diagnostics_)
|
||||
<< expr->source << " unresolved identifier:\n"
|
||||
<< "resolved: " << (sem_resolved ? sem_resolved->TypeInfo().name : "<null>") << "\n"
|
||||
|
|
|
@ -174,10 +174,17 @@ TEST_F(ResolverValidationTest, Expr_DontCall_Builtin) {
|
|||
|
||||
TEST_F(ResolverValidationTest, Expr_DontCall_Type) {
|
||||
Alias("T", ty.u32());
|
||||
WrapInFunction(Expr(Source{{{3, 3}, {3, 8}}}, "T"));
|
||||
WrapInFunction(Expr(Source{{12, 34}}, "T"));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "3:8 error: missing '(' for type initializer or cast");
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing '(' for type initializer or cast");
|
||||
}
|
||||
|
||||
TEST_F(ResolverValidationTest, Expr_DontCall_ShortName) {
|
||||
WrapInFunction(Expr(Source{{12, 34}}, "vec3f"));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(), "12:34 error: missing '(' for type initializer or cast");
|
||||
}
|
||||
|
||||
TEST_F(ResolverValidationTest, AssignmentStmt_InvalidLHS_BuiltinFunctionName) {
|
||||
|
|
Loading…
Reference in New Issue