resolver: Fix ICE when using a builtin as a type

Bug: chromium:1308209
Change-Id: I779d7fcb4a32640663077cb2176875f6081098a0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/84260
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/resolver/resolver.cc b/src/tint/resolver/resolver.cc
index 5c7e36a..bb05c9d 100644
--- a/src/tint/resolver/resolver.cc
+++ b/src/tint/resolver/resolver.cc
@@ -275,6 +275,14 @@
               return nullptr;
             },
             [&](Default) {
+              if (auto* tn = ty->As<ast::TypeName>()) {
+                if (IsBuiltin(tn->name)) {
+                  auto name = builder_->Symbols().NameFor(tn->name);
+                  AddError("cannot use builtin '" + name + "' as type",
+                           ty->source);
+                  return nullptr;
+                }
+              }
               TINT_UNREACHABLE(Resolver, diagnostics_)
                   << "Unhandled resolved type '"
                   << (resolved ? resolved->TypeInfo().name : "<null>")