diff --git a/src/ast/module.cc b/src/ast/module.cc index 0d0c261fde..101d7461aa 100644 --- a/src/ast/module.cc +++ b/src/ast/module.cc @@ -56,8 +56,8 @@ bool Module::IsValid() const { if (ty == nullptr) { return false; } - if (ty->IsAlias()) { - auto* alias = ty->AsAlias(); + if (ty->Is()) { + auto* alias = ty->As(); if (alias->type() == nullptr) { return false; } @@ -91,8 +91,8 @@ std::string Module::to_str() const { for (size_t i = 0; i < indent; ++i) { out << " "; } - if (ty->IsAlias()) { - auto* alias = ty->AsAlias(); + if (ty->Is()) { + auto* alias = ty->As(); out << alias->name() << " -> " << alias->type()->type_name() << std::endl; if (alias->type()->IsStruct()) { alias->type()->AsStruct()->impl()->to_str(out, indent); diff --git a/src/ast/type/access_control_type_test.cc b/src/ast/type/access_control_type_test.cc index afa2463eac..523bd36083 100644 --- a/src/ast/type/access_control_type_test.cc +++ b/src/ast/type/access_control_type_test.cc @@ -47,19 +47,20 @@ TEST_F(AccessControlTypeTest, Is) { I32Type i32; AccessControlType at{AccessControl::kReadOnly, &i32}; - EXPECT_TRUE(at.Is()); - EXPECT_FALSE(at.IsAlias()); - EXPECT_FALSE(at.IsArray()); - EXPECT_FALSE(at.IsBool()); - EXPECT_FALSE(at.IsF32()); - EXPECT_FALSE(at.IsI32()); - EXPECT_FALSE(at.IsMatrix()); - EXPECT_FALSE(at.IsPointer()); - EXPECT_FALSE(at.IsSampler()); - EXPECT_FALSE(at.IsStruct()); - EXPECT_FALSE(at.IsTexture()); - EXPECT_FALSE(at.IsU32()); - EXPECT_FALSE(at.IsVector()); + Type* ty = &at; + EXPECT_TRUE(ty->Is()); + EXPECT_FALSE(ty->Is()); + EXPECT_FALSE(ty->IsArray()); + EXPECT_FALSE(ty->IsBool()); + EXPECT_FALSE(ty->IsF32()); + EXPECT_FALSE(ty->IsI32()); + EXPECT_FALSE(ty->IsMatrix()); + EXPECT_FALSE(ty->IsPointer()); + EXPECT_FALSE(ty->IsSampler()); + EXPECT_FALSE(ty->IsStruct()); + EXPECT_FALSE(ty->IsTexture()); + EXPECT_FALSE(ty->IsU32()); + EXPECT_FALSE(ty->IsVector()); } TEST_F(AccessControlTypeTest, AccessRead) { diff --git a/src/ast/type/alias_type.cc b/src/ast/type/alias_type.cc index 6944cf32c2..f2fece845f 100644 --- a/src/ast/type/alias_type.cc +++ b/src/ast/type/alias_type.cc @@ -29,10 +29,6 @@ AliasType::AliasType(AliasType&&) = default; AliasType::~AliasType() = default; -bool AliasType::IsAlias() const { - return true; -} - std::string AliasType::type_name() const { return "__alias_" + name_ + subtype_->type_name(); } diff --git a/src/ast/type/alias_type.h b/src/ast/type/alias_type.h index 9e08d21822..1476b59e9b 100644 --- a/src/ast/type/alias_type.h +++ b/src/ast/type/alias_type.h @@ -34,9 +34,6 @@ class AliasType : public Castable { AliasType(AliasType&&); ~AliasType() override; - /// @returns true if the type is an alias type - bool IsAlias() const override; - /// @returns the alias name const std::string& name() const { return name_; } /// @returns the alias type diff --git a/src/ast/type/alias_type_test.cc b/src/ast/type/alias_type_test.cc index 9c2137a775..e54b165012 100644 --- a/src/ast/type/alias_type_test.cc +++ b/src/ast/type/alias_type_test.cc @@ -50,7 +50,7 @@ TEST_F(AliasTypeTest, Is) { AliasType at{"a", &i32}; Type* ty = &at; EXPECT_FALSE(ty->Is()); - EXPECT_TRUE(ty->IsAlias()); + EXPECT_TRUE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/array_type_test.cc b/src/ast/type/array_type_test.cc index 04267d3719..12c486c59d 100644 --- a/src/ast/type/array_type_test.cc +++ b/src/ast/type/array_type_test.cc @@ -54,7 +54,7 @@ TEST_F(ArrayTypeTest, Is) { ArrayType arr{&i32, 3}; Type* ty = &arr; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_TRUE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/bool_type_test.cc b/src/ast/type/bool_type_test.cc index 9efe20c3d0..3775a2c7c5 100644 --- a/src/ast/type/bool_type_test.cc +++ b/src/ast/type/bool_type_test.cc @@ -28,7 +28,7 @@ TEST_F(BoolTypeTest, Is) { BoolType b; Type* ty = &b; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_TRUE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/depth_texture_type_test.cc b/src/ast/type/depth_texture_type_test.cc index 852dc62916..a06af27360 100644 --- a/src/ast/type/depth_texture_type_test.cc +++ b/src/ast/type/depth_texture_type_test.cc @@ -29,7 +29,7 @@ TEST_F(DepthTextureTypeTest, Is) { DepthTextureType d(TextureDimension::kCube); Type* ty = &d; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/f32_type_test.cc b/src/ast/type/f32_type_test.cc index 3267400b63..93cd1ca6f6 100644 --- a/src/ast/type/f32_type_test.cc +++ b/src/ast/type/f32_type_test.cc @@ -28,7 +28,7 @@ TEST_F(F32TypeTest, Is) { F32Type f; Type* ty = &f; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_TRUE(ty->IsF32()); diff --git a/src/ast/type/i32_type_test.cc b/src/ast/type/i32_type_test.cc index d0d3e25b9b..11dbd96821 100644 --- a/src/ast/type/i32_type_test.cc +++ b/src/ast/type/i32_type_test.cc @@ -28,7 +28,7 @@ TEST_F(I32TypeTest, Is) { I32Type i; Type* ty = &i; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/matrix_type_test.cc b/src/ast/type/matrix_type_test.cc index 068aeed949..1990dcc932 100644 --- a/src/ast/type/matrix_type_test.cc +++ b/src/ast/type/matrix_type_test.cc @@ -38,7 +38,7 @@ TEST_F(MatrixTypeTest, Is) { MatrixType m{&i32, 2, 3}; Type* ty = &m; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/multisampled_texture_type_test.cc b/src/ast/type/multisampled_texture_type_test.cc index 8c89c9a427..7a7a54d3e3 100644 --- a/src/ast/type/multisampled_texture_type_test.cc +++ b/src/ast/type/multisampled_texture_type_test.cc @@ -30,7 +30,7 @@ TEST_F(MultisampledTextureTypeTest, Is) { MultisampledTextureType s(TextureDimension::kCube, &f32); Type* ty = &s; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/pointer_type_test.cc b/src/ast/type/pointer_type_test.cc index 9d3764d55c..9014cce413 100644 --- a/src/ast/type/pointer_type_test.cc +++ b/src/ast/type/pointer_type_test.cc @@ -37,7 +37,7 @@ TEST_F(PointerTypeTest, Is) { PointerType p{&i32, StorageClass::kFunction}; Type* ty = &p; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/sampled_texture_type_test.cc b/src/ast/type/sampled_texture_type_test.cc index d709928399..a8f41d7532 100644 --- a/src/ast/type/sampled_texture_type_test.cc +++ b/src/ast/type/sampled_texture_type_test.cc @@ -30,7 +30,7 @@ TEST_F(SampledTextureTypeTest, Is) { SampledTextureType s(TextureDimension::kCube, &f32); Type* ty = &s; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/sampler_type_test.cc b/src/ast/type/sampler_type_test.cc index 263c93bda8..2189e92aa4 100644 --- a/src/ast/type/sampler_type_test.cc +++ b/src/ast/type/sampler_type_test.cc @@ -39,7 +39,7 @@ TEST_F(SamplerTypeTest, Is) { SamplerType s{SamplerKind::kSampler}; Type* ty = &s; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/storage_texture_type_test.cc b/src/ast/type/storage_texture_type_test.cc index 4cd3af44ae..ed6bbe070b 100644 --- a/src/ast/type/storage_texture_type_test.cc +++ b/src/ast/type/storage_texture_type_test.cc @@ -33,7 +33,7 @@ TEST_F(StorageTextureTypeTest, Is) { ImageFormat::kRgba32Float); Type* ty = &s; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/struct_type_test.cc b/src/ast/type/struct_type_test.cc index 9d83f01cc0..05378ea9ad 100644 --- a/src/ast/type/struct_type_test.cc +++ b/src/ast/type/struct_type_test.cc @@ -46,7 +46,7 @@ TEST_F(StructTypeTest, Is) { StructType s{"S", impl}; Type* ty = &s; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/type.cc b/src/ast/type/type.cc index 9587688e6d..41634fbf4f 100644 --- a/src/ast/type/type.cc +++ b/src/ast/type/type.cc @@ -51,8 +51,8 @@ Type* Type::UnwrapPtrIfNeeded() { Type* Type::UnwrapIfNeeded() { auto* where = this; while (true) { - if (where->IsAlias()) { - where = where->AsAlias()->type(); + if (where->Is()) { + where = where->As()->type(); } else if (where->Is()) { where = where->As()->type(); } else { @@ -66,10 +66,6 @@ Type* Type::UnwrapAll() { return UnwrapIfNeeded()->UnwrapPtrIfNeeded()->UnwrapIfNeeded(); } -bool Type::IsAlias() const { - return false; -} - bool Type::IsArray() const { return false; } @@ -170,11 +166,6 @@ bool Type::is_integer_scalar_or_vector() { return is_unsigned_scalar_or_vector() || is_signed_scalar_or_vector(); } -const AliasType* Type::AsAlias() const { - assert(IsAlias()); - return static_cast(this); -} - const ArrayType* Type::AsArray() const { assert(IsArray()); return static_cast(this); @@ -235,11 +226,6 @@ const VoidType* Type::AsVoid() const { return static_cast(this); } -AliasType* Type::AsAlias() { - assert(IsAlias()); - return static_cast(this); -} - ArrayType* Type::AsArray() { assert(IsArray()); return static_cast(this); diff --git a/src/ast/type/type.h b/src/ast/type/type.h index ad83af92ad..04905c9400 100644 --- a/src/ast/type/type.h +++ b/src/ast/type/type.h @@ -23,7 +23,6 @@ namespace tint { namespace ast { namespace type { -class AliasType; class ArrayType; class BoolType; class F32Type; @@ -47,8 +46,6 @@ class Type : public Castable { Type(Type&&); ~Type() override; - /// @returns true if the type is an alias type - virtual bool IsAlias() const; /// @returns true if the type is an array type virtual bool IsArray() const; /// @returns true if the type is a bool type @@ -128,8 +125,6 @@ class Type : public Castable { /// @returns true if this type is an integer scalar or vector bool is_integer_scalar_or_vector(); - /// @returns the type as an alias type - const AliasType* AsAlias() const; /// @returns the type as an array type const ArrayType* AsArray() const; /// @returns the type as a bool type @@ -155,8 +150,6 @@ class Type : public Castable { /// @returns the type as a void type const VoidType* AsVoid() const; - /// @returns the type as an alias type - AliasType* AsAlias(); /// @returns the type as an array type ArrayType* AsArray(); /// @returns the type as a bool type diff --git a/src/ast/type/u32_type_test.cc b/src/ast/type/u32_type_test.cc index 0a8af4b077..1a2450f56f 100644 --- a/src/ast/type/u32_type_test.cc +++ b/src/ast/type/u32_type_test.cc @@ -28,7 +28,7 @@ TEST_F(U32TypeTest, Is) { U32Type u; Type* ty = &u; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/ast/type/vector_type_test.cc b/src/ast/type/vector_type_test.cc index 3eed2cf8a5..c8a4188d80 100644 --- a/src/ast/type/vector_type_test.cc +++ b/src/ast/type/vector_type_test.cc @@ -37,7 +37,7 @@ TEST_F(VectorTypeTest, Is) { VectorType v{&i32, 4}; Type* ty = &v; EXPECT_FALSE(ty->Is()); - EXPECT_FALSE(ty->IsAlias()); + EXPECT_FALSE(ty->Is()); EXPECT_FALSE(ty->IsArray()); EXPECT_FALSE(ty->IsBool()); EXPECT_FALSE(ty->IsF32()); diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index 6aab58963a..019f442f33 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -903,7 +903,7 @@ Maybe ParserImpl::type_alias() { auto* alias = module_.create(name.value, type.value); register_constructed(name.value, alias); - return alias->AsAlias(); + return alias; } // type_decl diff --git a/src/reader/wgsl/parser_impl_global_decl_test.cc b/src/reader/wgsl/parser_impl_global_decl_test.cc index 956aaf844f..de5bcf7845 100644 --- a/src/reader/wgsl/parser_impl_global_decl_test.cc +++ b/src/reader/wgsl/parser_impl_global_decl_test.cc @@ -88,8 +88,8 @@ TEST_F(ParserImplTest, GlobalDecl_TypeAlias) { auto& m = p->get_module(); ASSERT_EQ(m.constructed_types().size(), 1u); - ASSERT_TRUE(m.constructed_types()[0]->IsAlias()); - EXPECT_EQ(m.constructed_types()[0]->AsAlias()->name(), "A"); + ASSERT_TRUE(m.constructed_types()[0]->Is()); + EXPECT_EQ(m.constructed_types()[0]->As()->name(), "A"); } TEST_F(ParserImplTest, GlobalDecl_TypeAlias_StructIdent) { @@ -107,8 +107,8 @@ type B = A;)"); auto* str = m.constructed_types()[0]->AsStruct(); EXPECT_EQ(str->name(), "A"); - ASSERT_TRUE(m.constructed_types()[1]->IsAlias()); - auto* alias = m.constructed_types()[1]->AsAlias(); + ASSERT_TRUE(m.constructed_types()[1]->Is()); + auto* alias = m.constructed_types()[1]->As(); EXPECT_EQ(alias->name(), "B"); EXPECT_EQ(alias->type(), str); } diff --git a/src/reader/wgsl/parser_impl_type_alias_test.cc b/src/reader/wgsl/parser_impl_type_alias_test.cc index e224fefa57..45d02a336a 100644 --- a/src/reader/wgsl/parser_impl_type_alias_test.cc +++ b/src/reader/wgsl/parser_impl_type_alias_test.cc @@ -36,8 +36,8 @@ TEST_F(ParserImplTest, TypeDecl_ParsesType) { EXPECT_FALSE(t.errored); EXPECT_TRUE(t.matched); ASSERT_NE(t.value, nullptr); - ASSERT_TRUE(t->IsAlias()); - auto* alias = t->AsAlias(); + ASSERT_TRUE(t->Is()); + auto* alias = t->As(); ASSERT_TRUE(alias->type()->IsI32()); ASSERT_EQ(alias->type(), i32); } @@ -53,8 +53,8 @@ TEST_F(ParserImplTest, TypeDecl_ParsesStruct_Ident) { EXPECT_FALSE(t.errored); EXPECT_TRUE(t.matched); ASSERT_NE(t.value, nullptr); - ASSERT_TRUE(t->IsAlias()); - auto* alias = t->AsAlias(); + ASSERT_TRUE(t->Is()); + auto* alias = t->As(); EXPECT_EQ(alias->name(), "a"); ASSERT_TRUE(alias->type()->IsStruct()); diff --git a/src/reader/wgsl/parser_impl_type_decl_test.cc b/src/reader/wgsl/parser_impl_type_decl_test.cc index 50d9bd4bc8..9f9f8e96b6 100644 --- a/src/reader/wgsl/parser_impl_type_decl_test.cc +++ b/src/reader/wgsl/parser_impl_type_decl_test.cc @@ -58,9 +58,9 @@ TEST_F(ParserImplTest, TypeDecl_Identifier) { EXPECT_FALSE(t.errored); ASSERT_NE(t.value, nullptr) << p->error(); EXPECT_EQ(t.value, alias_type); - ASSERT_TRUE(t->IsAlias()); + ASSERT_TRUE(t->Is()); - auto* alias = t->AsAlias(); + auto* alias = t->As(); EXPECT_EQ(alias->name(), "A"); EXPECT_EQ(alias->type(), int_type); } diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc index 2e62109dcb..c321e91be1 100644 --- a/src/writer/hlsl/generator_impl.cc +++ b/src/writer/hlsl/generator_impl.cc @@ -212,8 +212,8 @@ bool GeneratorImpl::EmitConstructedType(std::ostream& out, const ast::type::Type* ty) { make_indent(out); - if (ty->IsAlias()) { - auto* alias = ty->AsAlias(); + if (ty->Is()) { + auto* alias = ty->As(); // HLSL typedef is for intrinsic types only. For an alias'd struct, // generate a secondary struct with the new name. if (alias->type()->IsStruct()) { @@ -2029,8 +2029,8 @@ bool GeneratorImpl::EmitSwitch(std::ostream& out, ast::SwitchStatement* stmt) { bool GeneratorImpl::EmitType(std::ostream& out, ast::type::Type* type, const std::string& name) { - if (type->IsAlias()) { - auto* alias = type->AsAlias(); + if (type->Is()) { + auto* alias = type->As(); out << namer_.NameFor(alias->name()); } else if (type->IsArray()) { auto* ary = type->AsArray(); diff --git a/src/writer/msl/generator_impl.cc b/src/writer/msl/generator_impl.cc index 0f1b2e353b..7bfb40c6a8 100644 --- a/src/writer/msl/generator_impl.cc +++ b/src/writer/msl/generator_impl.cc @@ -185,8 +185,8 @@ uint32_t GeneratorImpl::calculate_largest_alignment( } uint32_t GeneratorImpl::calculate_alignment_size(ast::type::Type* type) { - if (type->IsAlias()) { - return calculate_alignment_size(type->AsAlias()->type()); + if (type->Is()) { + return calculate_alignment_size(type->As()->type()); } if (type->IsArray()) { auto* ary = type->AsArray(); @@ -255,8 +255,8 @@ uint32_t GeneratorImpl::calculate_alignment_size(ast::type::Type* type) { bool GeneratorImpl::EmitConstructedType(const ast::type::Type* ty) { make_indent(); - if (ty->IsAlias()) { - auto* alias = ty->AsAlias(); + if (ty->Is()) { + auto* alias = ty->As(); out_ << "typedef "; if (!EmitType(alias->type(), "")) { @@ -1787,8 +1787,8 @@ bool GeneratorImpl::EmitSwitch(ast::SwitchStatement* stmt) { } bool GeneratorImpl::EmitType(ast::type::Type* type, const std::string& name) { - if (type->IsAlias()) { - auto* alias = type->AsAlias(); + if (type->Is()) { + auto* alias = type->As(); out_ << namer_.NameFor(alias->name()); } else if (type->IsArray()) { auto* ary = type->AsArray(); diff --git a/src/writer/spirv/builder.cc b/src/writer/spirv/builder.cc index 6e8c932f22..db90dcd9a8 100644 --- a/src/writer/spirv/builder.cc +++ b/src/writer/spirv/builder.cc @@ -2387,8 +2387,8 @@ uint32_t Builder::GenerateTypeIfNeeded(ast::type::Type* type) { } // The alias is a wrapper around the subtype, so emit the subtype - if (type->IsAlias()) { - return GenerateTypeIfNeeded(type->AsAlias()->type()); + if (type->Is()) { + return GenerateTypeIfNeeded(type->As()->type()); } auto val = type_name_to_id_.find(type->type_name()); diff --git a/src/writer/wgsl/generator_impl.cc b/src/writer/wgsl/generator_impl.cc index 16dfb9e3f8..7abf2169cf 100644 --- a/src/writer/wgsl/generator_impl.cc +++ b/src/writer/wgsl/generator_impl.cc @@ -168,8 +168,8 @@ bool GeneratorImpl::GenerateEntryPoint(const ast::Module& module, bool GeneratorImpl::EmitConstructedType(const ast::type::Type* ty) { make_indent(); - if (ty->IsAlias()) { - auto* alias = ty->AsAlias(); + if (ty->Is()) { + auto* alias = ty->As(); out_ << "type " << alias->name() << " = "; if (!EmitType(alias->type())) { return false; @@ -410,8 +410,8 @@ bool GeneratorImpl::EmitType(ast::type::Type* type) { if (!EmitType(ac->type())) { return false; } - } else if (type->IsAlias()) { - out_ << type->AsAlias()->name(); + } else if (type->Is()) { + out_ << type->As()->name(); } else if (type->IsArray()) { auto* ary = type->AsArray();