Move sampler to type.

This CL moves the sampler from sem to type and updates the namespace.

Bug: tint:1718
Change-Id: I22d228df5d24e154dbebecb43e7c6730475e08d2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113283
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn
index 76bdd76..7c29387 100644
--- a/src/tint/BUILD.gn
+++ b/src/tint/BUILD.gn
@@ -448,7 +448,6 @@
     "sem/pipeline_stage_set.h",
     "sem/pointer.h",
     "sem/reference.h",
-    "sem/sampler.h",
     "sem/sampler_texture_pair.h",
     "sem/struct.h",
     "sem/switch_statement.h",
@@ -576,6 +575,7 @@
     "type/multisampled_texture.h",
     "type/node.h",
     "type/sampled_texture.h",
+    "type/sampler.h",
     "type/storage_texture.h",
     "type/texture.h",
     "type/type.h",
@@ -699,8 +699,6 @@
     "sem/pointer.h",
     "sem/reference.cc",
     "sem/reference.h",
-    "sem/sampler.cc",
-    "sem/sampler.h",
     "sem/statement.cc",
     "sem/struct.cc",
     "sem/struct.h",
@@ -741,6 +739,8 @@
     "type/node.h",
     "type/sampled_texture.cc",
     "type/sampled_texture.h",
+    "type/sampler.cc",
+    "type/sampler.h",
     "type/storage_texture.cc",
     "type/storage_texture.h",
     "type/texture.cc",
@@ -1213,7 +1213,6 @@
       "sem/matrix_test.cc",
       "sem/pointer_test.cc",
       "sem/reference_test.cc",
-      "sem/sampler_test.cc",
       "sem/struct_test.cc",
       "sem/u32_test.cc",
       "sem/vector_test.cc",
@@ -1227,6 +1226,7 @@
       "type/external_texture_test.cc",
       "type/multisampled_texture_test.cc",
       "type/sampled_texture_test.cc",
+      "type/sampler_test.cc",
       "type/storage_texture_test.cc",
       "type/texture_test.cc",
       "type/type_manager_test.cc",
diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt
index b7d9988..6a38e9e 100644
--- a/src/tint/CMakeLists.txt
+++ b/src/tint/CMakeLists.txt
@@ -355,8 +355,6 @@
   sem/reference.cc
   sem/reference.h
   sem/sampler_texture_pair.h
-  sem/sampler.cc
-  sem/sampler.h
   sem/statement.cc
   sem/struct.cc
   sem/switch_statement.cc
@@ -497,6 +495,8 @@
   type/node.h
   type/sampled_texture.cc
   type/sampled_texture.h
+  type/sampler.cc
+  type/sampler.h
   type/storage_texture.cc
   type/storage_texture.h
   type/texture.cc
@@ -931,7 +931,6 @@
     sem/matrix_test.cc
     sem/pointer_test.cc
     sem/reference_test.cc
-    sem/sampler_test.cc
     sem/struct_test.cc
     sem/u32_test.cc
     sem/vector_test.cc
@@ -947,6 +946,7 @@
     type/external_texture_test.cc
     type/multisampled_texture_test.cc
     type/sampled_texture_test.cc
+    type/sampler_test.cc
     type/storage_texture_test.cc
     type/texture_test.cc
     type/type_test.cc
diff --git a/src/tint/resolver/intrinsic_table.cc b/src/tint/resolver/intrinsic_table.cc
index ba46140..83d355c 100644
--- a/src/tint/resolver/intrinsic_table.cc
+++ b/src/tint/resolver/intrinsic_table.cc
@@ -584,11 +584,11 @@
     if (ty->Is<Any>()) {
         return true;
     }
-    return ty->Is([](const sem::Sampler* s) { return s->kind() == ast::SamplerKind::kSampler; });
+    return ty->Is([](const type::Sampler* s) { return s->kind() == ast::SamplerKind::kSampler; });
 }
 
-const sem::Sampler* build_sampler(MatchState& state) {
-    return state.builder.create<sem::Sampler>(ast::SamplerKind::kSampler);
+const type::Sampler* build_sampler(MatchState& state) {
+    return state.builder.create<type::Sampler>(ast::SamplerKind::kSampler);
 }
 
 bool match_sampler_comparison(MatchState&, const type::Type* ty) {
@@ -596,11 +596,11 @@
         return true;
     }
     return ty->Is(
-        [](const sem::Sampler* s) { return s->kind() == ast::SamplerKind::kComparisonSampler; });
+        [](const type::Sampler* s) { return s->kind() == ast::SamplerKind::kComparisonSampler; });
 }
 
-const sem::Sampler* build_sampler_comparison(MatchState& state) {
-    return state.builder.create<sem::Sampler>(ast::SamplerKind::kComparisonSampler);
+const type::Sampler* build_sampler_comparison(MatchState& state) {
+    return state.builder.create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
 }
 
 bool match_texture(MatchState&,
diff --git a/src/tint/resolver/intrinsic_table_test.cc b/src/tint/resolver/intrinsic_table_test.cc
index c3f69ad..8ce477f 100644
--- a/src/tint/resolver/intrinsic_table_test.cc
+++ b/src/tint/resolver/intrinsic_table_test.cc
@@ -280,7 +280,7 @@
     auto* vec2_f32 = create<sem::Vector>(f32, 2u);
     auto* vec4_f32 = create<sem::Vector>(f32, 4u);
     auto* tex = create<type::SampledTexture>(ast::TextureDimension::k2d, f32);
-    auto* sampler = create<sem::Sampler>(ast::SamplerKind::kSampler);
+    auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
     auto result = table->Lookup(BuiltinType::kTextureSample, utils::Vector{tex, sampler, vec2_f32},
                                 sem::EvaluationStage::kConstant, Source{});
     ASSERT_NE(result.sem, nullptr) << Diagnostics().str();
diff --git a/src/tint/resolver/resolver.cc b/src/tint/resolver/resolver.cc
index a4cd057..a7d43db 100644
--- a/src/tint/resolver/resolver.cc
+++ b/src/tint/resolver/resolver.cc
@@ -69,7 +69,6 @@
 #include "src/tint/sem/module.h"
 #include "src/tint/sem/pointer.h"
 #include "src/tint/sem/reference.h"
-#include "src/tint/sem/sampler.h"
 #include "src/tint/sem/statement.h"
 #include "src/tint/sem/struct.h"
 #include "src/tint/sem/switch_statement.h"
@@ -81,6 +80,7 @@
 #include "src/tint/type/depth_texture.h"
 #include "src/tint/type/multisampled_texture.h"
 #include "src/tint/type/sampled_texture.h"
+#include "src/tint/type/sampler.h"
 #include "src/tint/type/storage_texture.h"
 #include "src/tint/utils/defer.h"
 #include "src/tint/utils/math.h"
@@ -278,7 +278,7 @@
             }
             return nullptr;
         },
-        [&](const ast::Sampler* t) { return builder_->create<sem::Sampler>(t->kind); },
+        [&](const ast::Sampler* t) { return builder_->create<type::Sampler>(t->kind); },
         [&](const ast::SampledTexture* t) -> type::SampledTexture* {
             if (auto* el = Type(t->type)) {
                 auto* sem = builder_->create<type::SampledTexture>(t->dim, el);
diff --git a/src/tint/resolver/validator.cc b/src/tint/resolver/validator.cc
index a442080..ac3489c 100644
--- a/src/tint/resolver/validator.cc
+++ b/src/tint/resolver/validator.cc
@@ -60,7 +60,6 @@
 #include "src/tint/sem/member_accessor_expression.h"
 #include "src/tint/sem/pointer.h"
 #include "src/tint/sem/reference.h"
-#include "src/tint/sem/sampler.h"
 #include "src/tint/sem/statement.h"
 #include "src/tint/sem/struct.h"
 #include "src/tint/sem/switch_statement.h"
@@ -72,6 +71,7 @@
 #include "src/tint/type/depth_texture.h"
 #include "src/tint/type/multisampled_texture.h"
 #include "src/tint/type/sampled_texture.h"
+#include "src/tint/type/sampler.h"
 #include "src/tint/type/storage_texture.h"
 #include "src/tint/utils/defer.h"
 #include "src/tint/utils/map.h"
@@ -231,7 +231,7 @@
 
 // https://gpuweb.github.io/gpuweb/wgsl.html#storable-types
 bool Validator::IsStorable(const type::Type* type) const {
-    return IsPlain(type) || type->IsAnyOf<type::Texture, sem::Sampler>();
+    return IsPlain(type) || type->IsAnyOf<type::Texture, type::Sampler>();
 }
 
 const ast::Statement* Validator::ClosestContinuing(bool stop_at_loop,
@@ -832,7 +832,7 @@
             AddError("type of function parameter must be constructible", decl->type->source);
             return false;
         }
-    } else if (!var->Type()->IsAnyOf<type::Texture, sem::Sampler, sem::Pointer>()) {
+    } else if (!var->Type()->IsAnyOf<type::Texture, type::Sampler, sem::Pointer>()) {
         AddError("type of function parameter cannot be " + sem_.TypeNameOf(var->Type()),
                  decl->source);
         return false;
@@ -2266,7 +2266,7 @@
         // https://www.w3.org/TR/WGSL/#phony-assignment-section
         auto* ty = rhs_ty->UnwrapRef();
         if (!ty->IsConstructible() &&
-            !ty->IsAnyOf<sem::Pointer, type::Texture, sem::Sampler, sem::AbstractNumeric>()) {
+            !ty->IsAnyOf<sem::Pointer, type::Texture, type::Sampler, sem::AbstractNumeric>()) {
             AddError("cannot assign '" + sem_.TypeNameOf(rhs_ty) +
                          "' to '_'. '_' can only be assigned a constructible, pointer, texture or "
                          "sampler type",
diff --git a/src/tint/sem/call_target.h b/src/tint/sem/call_target.h
index 013c490..fed8a82 100644
--- a/src/tint/sem/call_target.h
+++ b/src/tint/sem/call_target.h
@@ -18,8 +18,8 @@
 #include <vector>
 
 #include "src/tint/sem/node.h"
-#include "src/tint/sem/sampler.h"
 #include "src/tint/sem/variable.h"
+#include "src/tint/type/sampler.h"
 #include "src/tint/utils/hash.h"
 #include "src/tint/utils/vector.h"
 
diff --git a/src/tint/sem/function.cc b/src/tint/sem/function.cc
index 3560a85..6f074a4 100644
--- a/src/tint/sem/function.cc
+++ b/src/tint/sem/function.cc
@@ -154,7 +154,7 @@
 
     for (auto* global : TransitivelyReferencedGlobals()) {
         auto* unwrapped_type = global->Type()->UnwrapRef();
-        auto* sampler = unwrapped_type->As<sem::Sampler>();
+        auto* sampler = unwrapped_type->As<type::Sampler>();
         if (sampler == nullptr || sampler->kind() != kind) {
             continue;
         }
diff --git a/src/tint/transform/combine_samplers.cc b/src/tint/transform/combine_samplers.cc
index 6ddafb5..4f68388 100644
--- a/src/tint/transform/combine_samplers.cc
+++ b/src/tint/transform/combine_samplers.cc
@@ -159,7 +159,7 @@
         for (auto* global : ctx.src->AST().GlobalVariables()) {
             auto* global_sem = sem.Get(global)->As<sem::GlobalVariable>();
             auto* type = sem.Get(global->type);
-            if (tint::IsAnyOf<type::Texture, sem::Sampler>(type) &&
+            if (tint::IsAnyOf<type::Texture, type::Sampler>(type) &&
                 !type->Is<type::StorageTexture>()) {
                 ctx.Remove(ctx.src->AST().GlobalDeclarations(), global);
             } else if (global->HasBindingPoint()) {
@@ -208,7 +208,7 @@
                 // Filter out separate textures and samplers from the original
                 // function signature.
                 for (auto* param : fn->Parameters()) {
-                    if (!param->Type()->IsAnyOf<type::Texture, sem::Sampler>()) {
+                    if (!param->Type()->IsAnyOf<type::Texture, type::Sampler>()) {
                         params.Push(ctx.Clone(param->Declaration()));
                     }
                 }
@@ -263,7 +263,7 @@
                                     : function_combined_texture_samplers_[call->Stmt()->Function()]
                                                                          [new_pair];
                             args.Push(ctx.dst->Expr(var->symbol));
-                        } else if (auto* sampler_type = type->As<sem::Sampler>()) {
+                        } else if (auto* sampler_type = type->As<type::Sampler>()) {
                             ast::SamplerKind kind = sampler_type->kind();
                             int index = (kind == ast::SamplerKind::kSampler) ? 0 : 1;
                             const ast::Variable*& p = placeholder_samplers_[index];
@@ -321,7 +321,7 @@
                     for (auto* arg : expr->args) {
                         if (!ctx.src->TypeOf(arg)
                                  ->UnwrapRef()
-                                 ->IsAnyOf<type::Texture, sem::Sampler>()) {
+                                 ->IsAnyOf<type::Texture, type::Sampler>()) {
                             args.Push(ctx.Clone(arg));
                         }
                     }
diff --git a/src/tint/transform/promote_side_effects_to_decl.cc b/src/tint/transform/promote_side_effects_to_decl.cc
index 639cb63..7a5254d 100644
--- a/src/tint/transform/promote_side_effects_to_decl.cc
+++ b/src/tint/transform/promote_side_effects_to_decl.cc
@@ -287,7 +287,7 @@
                         }
                         // Don't hoist textures / samplers as they can't be placed into a let, nor
                         // can they have side effects.
-                        if (var_user->Variable()->Type()->IsAnyOf<type::Texture, sem::Sampler>()) {
+                        if (var_user->Variable()->Type()->IsAnyOf<type::Texture, type::Sampler>()) {
                             return false;
                         }
                         return true;
diff --git a/src/tint/transform/transform.cc b/src/tint/transform/transform.cc
index 0b5a7f9..e2a537a 100644
--- a/src/tint/transform/transform.cc
+++ b/src/tint/transform/transform.cc
@@ -22,9 +22,9 @@
 #include "src/tint/sem/block_statement.h"
 #include "src/tint/sem/for_loop_statement.h"
 #include "src/tint/sem/reference.h"
-#include "src/tint/sem/sampler.h"
 #include "src/tint/sem/variable.h"
 #include "src/tint/type/depth_multisampled_texture.h"
+#include "src/tint/type/sampler.h"
 
 TINT_INSTANTIATE_TYPEINFO(tint::transform::Transform);
 TINT_INSTANTIATE_TYPEINFO(tint::transform::Data);
@@ -165,7 +165,7 @@
         return ctx.dst->create<ast::StorageTexture>(t->dim(), t->texel_format(),
                                                     CreateASTTypeFor(ctx, t->type()), t->access());
     }
-    if (auto* s = ty->As<sem::Sampler>()) {
+    if (auto* s = ty->As<type::Sampler>()) {
         return ctx.dst->create<ast::Sampler>(s->kind());
     }
     TINT_UNREACHABLE(Transform, ctx.dst->Diagnostics())
diff --git a/src/tint/sem/sampler.cc b/src/tint/type/sampler.cc
similarity index 87%
rename from src/tint/sem/sampler.cc
rename to src/tint/type/sampler.cc
index 4d1e9b2..c6d1975 100644
--- a/src/tint/sem/sampler.cc
+++ b/src/tint/type/sampler.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Tint Authors.
+// Copyright 2022 The Tint Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -12,14 +12,14 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "src/tint/sem/sampler.h"
+#include "src/tint/type/sampler.h"
 
 #include "src/tint/program_builder.h"
 #include "src/tint/utils/hash.h"
 
-TINT_INSTANTIATE_TYPEINFO(tint::sem::Sampler);
+TINT_INSTANTIATE_TYPEINFO(tint::type::Sampler);
 
-namespace tint::sem {
+namespace tint::type {
 
 Sampler::Sampler(ast::SamplerKind kind) : Base(type::TypeFlags{}), kind_(kind) {}
 
@@ -42,4 +42,4 @@
     return kind_ == ast::SamplerKind::kSampler ? "sampler" : "sampler_comparison";
 }
 
-}  // namespace tint::sem
+}  // namespace tint::type
diff --git a/src/tint/sem/sampler.h b/src/tint/type/sampler.h
similarity index 89%
rename from src/tint/sem/sampler.h
rename to src/tint/type/sampler.h
index 8ec485f..5c205a3 100644
--- a/src/tint/sem/sampler.h
+++ b/src/tint/type/sampler.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Tint Authors.
+// Copyright 2022 The Tint Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -12,15 +12,15 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#ifndef SRC_TINT_SEM_SAMPLER_H_
-#define SRC_TINT_SEM_SAMPLER_H_
+#ifndef SRC_TINT_TYPE_SAMPLER_H_
+#define SRC_TINT_TYPE_SAMPLER_H_
 
 #include <string>
 
 #include "src/tint/ast/sampler.h"
 #include "src/tint/type/type.h"
 
-namespace tint::sem {
+namespace tint::type {
 
 /// A sampler type.
 class Sampler final : public Castable<Sampler, type::Type> {
@@ -54,6 +54,6 @@
     ast::SamplerKind const kind_;
 };
 
-}  // namespace tint::sem
+}  // namespace tint::type
 
-#endif  // SRC_TINT_SEM_SAMPLER_H_
+#endif  // SRC_TINT_TYPE_SAMPLER_H_
diff --git a/src/tint/sem/sampler_test.cc b/src/tint/type/sampler_test.cc
similarity index 90%
rename from src/tint/sem/sampler_test.cc
rename to src/tint/type/sampler_test.cc
index 65b3882..6d0e188 100644
--- a/src/tint/sem/sampler_test.cc
+++ b/src/tint/type/sampler_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Tint Authors.
+// Copyright 2022 The Tint Authors.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -12,11 +12,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-#include "src/tint/sem/sampler.h"
-#include "src/tint/sem/test_helper.h"
+#include "src/tint/type/sampler.h"
+#include "src/tint/type/test_helper.h"
 #include "src/tint/type/texture.h"
 
-namespace tint::sem {
+namespace tint::type {
 namespace {
 
 using SamplerTest = TestHelper;
@@ -52,7 +52,7 @@
 
     EXPECT_TRUE(a->Equals(*b));
     EXPECT_FALSE(a->Equals(*c));
-    EXPECT_FALSE(a->Equals(Void{}));
+    EXPECT_FALSE(a->Equals(sem::Void{}));
 }
 
 TEST_F(SamplerTest, FriendlyNameSampler) {
@@ -66,4 +66,4 @@
 }
 
 }  // namespace
-}  // namespace tint::sem
+}  // namespace tint::type
diff --git a/src/tint/type/type.cc b/src/tint/type/type.cc
index 353570b..9955529 100644
--- a/src/tint/type/type.cc
+++ b/src/tint/type/type.cc
@@ -24,10 +24,10 @@
 #include "src/tint/sem/matrix.h"
 #include "src/tint/sem/pointer.h"
 #include "src/tint/sem/reference.h"
-#include "src/tint/sem/sampler.h"
 #include "src/tint/sem/struct.h"
 #include "src/tint/sem/u32.h"
 #include "src/tint/sem/vector.h"
+#include "src/tint/type/sampler.h"
 #include "src/tint/type/texture.h"
 
 TINT_INSTANTIATE_TYPEINFO(tint::type::Type);
@@ -172,7 +172,7 @@
 }
 
 bool Type::is_handle() const {
-    return IsAnyOf<sem::Sampler, type::Texture>();
+    return IsAnyOf<type::Sampler, type::Texture>();
 }
 
 bool Type::HoldsAbstract() const {
diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc
index cb02999..00f6490 100644
--- a/src/tint/writer/glsl/generator_impl.cc
+++ b/src/tint/writer/glsl/generator_impl.cc
@@ -2065,7 +2065,7 @@
 
     auto name = builder_.Symbols().NameFor(var->symbol);
     auto* type = sem->Type()->UnwrapRef();
-    if (type->Is<sem::Sampler>()) {
+    if (type->Is<type::Sampler>()) {
         // GLSL ignores Sampler variables.
         return true;
     }
@@ -2893,7 +2893,7 @@
             << "Attempting to emit pointer type. These should have been removed "
                "with the InlinePointerLets transform";
         return false;
-    } else if (type->Is<sem::Sampler>()) {
+    } else if (type->Is<type::Sampler>()) {
         return false;
     } else if (auto* str = type->As<sem::Struct>()) {
         out << StructName(str);
diff --git a/src/tint/writer/glsl/generator_impl_type_test.cc b/src/tint/writer/glsl/generator_impl_type_test.cc
index 6d672be..726b834 100644
--- a/src/tint/writer/glsl/generator_impl_type_test.cc
+++ b/src/tint/writer/glsl/generator_impl_type_test.cc
@@ -15,10 +15,10 @@
 #include "gmock/gmock.h"
 #include "src/tint/ast/call_statement.h"
 #include "src/tint/ast/stage_attribute.h"
-#include "src/tint/sem/sampler.h"
 #include "src/tint/type/depth_texture.h"
 #include "src/tint/type/multisampled_texture.h"
 #include "src/tint/type/sampled_texture.h"
+#include "src/tint/type/sampler.h"
 #include "src/tint/type/storage_texture.h"
 #include "src/tint/writer/glsl/test_helper.h"
 
@@ -279,7 +279,7 @@
 }
 
 TEST_F(GlslGeneratorImplTest_Type, EmitSampler) {
-    auto* sampler = create<sem::Sampler>(ast::SamplerKind::kSampler);
+    auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
 
     GeneratorImpl& gen = Build();
 
@@ -289,7 +289,7 @@
 }
 
 TEST_F(GlslGeneratorImplTest_Type, EmitSamplerComparison) {
-    auto* sampler = create<sem::Sampler>(ast::SamplerKind::kComparisonSampler);
+    auto* sampler = create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
 
     GeneratorImpl& gen = Build();
 
diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc
index f776a35..e989bfc 100644
--- a/src/tint/writer/hlsl/generator_impl.cc
+++ b/src/tint/writer/hlsl/generator_impl.cc
@@ -3064,7 +3064,7 @@
         if (unwrapped_type->Is<type::StorageTexture>()) {
             register_space = "u";
         }
-    } else if (unwrapped_type->Is<sem::Sampler>()) {
+    } else if (unwrapped_type->Is<type::Sampler>()) {
         register_space = "s";
     }
 
@@ -3999,7 +3999,7 @@
                    "removed with the InlinePointerLets transform";
             return false;
         },
-        [&](const sem::Sampler* sampler) {
+        [&](const type::Sampler* sampler) {
             out << "Sampler";
             if (sampler->IsComparison()) {
                 out << "Comparison";
diff --git a/src/tint/writer/hlsl/generator_impl_type_test.cc b/src/tint/writer/hlsl/generator_impl_type_test.cc
index 6ef0e05..b113205 100644
--- a/src/tint/writer/hlsl/generator_impl_type_test.cc
+++ b/src/tint/writer/hlsl/generator_impl_type_test.cc
@@ -15,10 +15,10 @@
 #include "gmock/gmock.h"
 #include "src/tint/ast/call_statement.h"
 #include "src/tint/ast/stage_attribute.h"
-#include "src/tint/sem/sampler.h"
 #include "src/tint/type/depth_texture.h"
 #include "src/tint/type/multisampled_texture.h"
 #include "src/tint/type/sampled_texture.h"
+#include "src/tint/type/sampler.h"
 #include "src/tint/type/storage_texture.h"
 #include "src/tint/writer/hlsl/test_helper.h"
 
@@ -273,7 +273,7 @@
 }
 
 TEST_F(HlslGeneratorImplTest_Type, EmitSampler) {
-    auto* sampler = create<sem::Sampler>(ast::SamplerKind::kSampler);
+    auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
 
     GeneratorImpl& gen = Build();
 
@@ -284,7 +284,7 @@
 }
 
 TEST_F(HlslGeneratorImplTest_Type, EmitSamplerComparison) {
-    auto* sampler = create<sem::Sampler>(ast::SamplerKind::kComparisonSampler);
+    auto* sampler = create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
 
     GeneratorImpl& gen = Build();
 
diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc
index 2d91763..4126fe0 100644
--- a/src/tint/writer/msl/generator_impl.cc
+++ b/src/tint/writer/msl/generator_impl.cc
@@ -2597,7 +2597,7 @@
             }
             return true;
         },
-        [&](const sem::Sampler*) {
+        [&](const type::Sampler*) {
             out << "sampler";
             return true;
         },
diff --git a/src/tint/writer/msl/generator_impl_type_test.cc b/src/tint/writer/msl/generator_impl_type_test.cc
index 5148974..0ea3bba 100644
--- a/src/tint/writer/msl/generator_impl_type_test.cc
+++ b/src/tint/writer/msl/generator_impl_type_test.cc
@@ -16,11 +16,11 @@
 
 #include "gmock/gmock.h"
 
-#include "src/tint/sem/sampler.h"
 #include "src/tint/type/depth_multisampled_texture.h"
 #include "src/tint/type/depth_texture.h"
 #include "src/tint/type/multisampled_texture.h"
 #include "src/tint/type/sampled_texture.h"
+#include "src/tint/type/sampler.h"
 #include "src/tint/type/storage_texture.h"
 #include "src/tint/writer/msl/test_helper.h"
 
@@ -730,7 +730,7 @@
 }
 
 TEST_F(MslGeneratorImplTest, EmitType_Sampler) {
-    auto* sampler = create<sem::Sampler>(ast::SamplerKind::kSampler);
+    auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
 
     GeneratorImpl& gen = Build();
 
@@ -740,7 +740,7 @@
 }
 
 TEST_F(MslGeneratorImplTest, EmitType_SamplerComparison) {
-    auto* sampler = create<sem::Sampler>(ast::SamplerKind::kComparisonSampler);
+    auto* sampler = create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
 
     GeneratorImpl& gen = Build();
 
diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc
index e03d95d..caa575f 100644
--- a/src/tint/writer/spirv/builder.cc
+++ b/src/tint/writer/spirv/builder.cc
@@ -797,7 +797,7 @@
                     break;
             }
         }
-        if (!type->Is<sem::Sampler>()) {
+        if (!type->Is<type::Sampler>()) {
             // If we don't have a initializer and we're an Output or Private
             // variable, then WGSL requires that we zero-initialize.
             // If we're a Workgroup variable, and the
@@ -3732,16 +3732,16 @@
                 return true;
             },
             [&](const type::Texture* tex) { return GenerateTextureType(tex, result); },
-            [&](const sem::Sampler* s) {
+            [&](const type::Sampler* s) {
                 push_type(spv::Op::OpTypeSampler, {result});
 
                 // Register both of the sampler type names. In SPIR-V they're the same
                 // sampler type, so we need to match that when we do the dedup check.
                 if (s->kind() == ast::SamplerKind::kSampler) {
-                    type_to_id_[builder_.create<sem::Sampler>(
+                    type_to_id_[builder_.create<type::Sampler>(
                         ast::SamplerKind::kComparisonSampler)] = id;
                 } else {
-                    type_to_id_[builder_.create<sem::Sampler>(ast::SamplerKind::kSampler)] = id;
+                    type_to_id_[builder_.create<type::Sampler>(ast::SamplerKind::kSampler)] = id;
                 }
                 return true;
             },
diff --git a/src/tint/writer/spirv/builder_type_test.cc b/src/tint/writer/spirv/builder_type_test.cc
index 5e00675..74d6cbc 100644
--- a/src/tint/writer/spirv/builder_type_test.cc
+++ b/src/tint/writer/spirv/builder_type_test.cc
@@ -964,7 +964,7 @@
 }
 
 TEST_F(BuilderTest_Type, Sampler) {
-    auto* sampler = create<sem::Sampler>(ast::SamplerKind::kSampler);
+    auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
 
     spirv::Builder& b = Build();
 
@@ -974,7 +974,7 @@
 }
 
 TEST_F(BuilderTest_Type, ComparisonSampler) {
-    auto* sampler = create<sem::Sampler>(ast::SamplerKind::kComparisonSampler);
+    auto* sampler = create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
 
     spirv::Builder& b = Build();
 
@@ -984,8 +984,8 @@
 }
 
 TEST_F(BuilderTest_Type, Dedup_Sampler_And_ComparisonSampler) {
-    auto* comp_sampler = create<sem::Sampler>(ast::SamplerKind::kComparisonSampler);
-    auto* sampler = create<sem::Sampler>(ast::SamplerKind::kSampler);
+    auto* comp_sampler = create<type::Sampler>(ast::SamplerKind::kComparisonSampler);
+    auto* sampler = create<type::Sampler>(ast::SamplerKind::kSampler);
 
     spirv::Builder& b = Build();