mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-15 08:06:19 +00:00
Remove ScalarConstructorExpression
Just make Literal an expression. The ScalarConstructorExpression provides no real value, aside from having a ConstructorExpression base class that's common between ScalarConstructorExpression and TypeConstructorExpression. TypeConstructorExpression will be folded into CallExpression, so this hierarchy will serve no purpose. First step in resolving the parser ambiguity of type-constructors vs type-casts vs function calls. Bug: tint:888 Change-Id: I2585d5ddbf6c0619a8f24c503e61ebf27c182ebe Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/68524 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
@@ -89,8 +89,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
// fn func { var a:i32 = 2; }
|
||||
auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2));
|
||||
|
||||
Func(Source{Source::Location{12, 34}}, "func", ast::VariableList{},
|
||||
ty.void_(),
|
||||
Func(Source{{12, 34}}, "func", ast::VariableList{}, ty.void_(),
|
||||
ast::StatementList{
|
||||
Decl(var),
|
||||
});
|
||||
@@ -103,11 +102,11 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
// var foo:f32 = 3.14;
|
||||
// fn foo() -> void {}
|
||||
|
||||
auto* global_var = Var(Source{Source::Location{56, 78}}, "foo", ty.f32(),
|
||||
auto* global_var = Var(Source{{56, 78}}, "foo", ty.f32(),
|
||||
ast::StorageClass::kPrivate, Expr(3.14f));
|
||||
AST().AddGlobalVariable(global_var);
|
||||
|
||||
Func(Source{Source::Location{12, 34}}, "foo", ast::VariableList{}, ty.void_(),
|
||||
Func(Source{{12, 34}}, "foo", ast::VariableList{}, ty.void_(),
|
||||
ast::StatementList{}, ast::DecorationList{});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve()) << r()->error();
|
||||
@@ -121,9 +120,9 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
// fn foo() -> void {}
|
||||
// var<private> foo:f32 = 3.14;
|
||||
|
||||
Func(Source{Source::Location{12, 34}}, "foo", ast::VariableList{}, ty.void_(),
|
||||
Func(Source{{12, 34}}, "foo", ast::VariableList{}, ty.void_(),
|
||||
ast::StatementList{}, ast::DecorationList{});
|
||||
auto* global_var = Var(Source{Source::Location{56, 78}}, "foo", ty.f32(),
|
||||
auto* global_var = Var(Source{{56, 78}}, "foo", ty.f32(),
|
||||
ast::StorageClass::kPrivate, Expr(3.14f));
|
||||
AST().AddGlobalVariable(global_var);
|
||||
|
||||
@@ -143,7 +142,7 @@ TEST_F(ResolverFunctionValidationTest, FunctionUsingSameVariableName_Pass) {
|
||||
Func("func", ast::VariableList{}, ty.i32(),
|
||||
ast::StatementList{
|
||||
Decl(var),
|
||||
Return(Source{Source::Location{12, 34}}, Expr("func")),
|
||||
Return(Source{{12, 34}}, Expr("func")),
|
||||
},
|
||||
ast::DecorationList{});
|
||||
|
||||
@@ -162,7 +161,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
},
|
||||
ast::DecorationList{});
|
||||
|
||||
Func(Source{Source::Location{12, 34}}, "b", ast::VariableList{}, ty.i32(),
|
||||
Func(Source{{12, 34}}, "b", ast::VariableList{}, ty.i32(),
|
||||
ast::StatementList{
|
||||
Return(2),
|
||||
},
|
||||
@@ -244,7 +243,7 @@ TEST_F(ResolverFunctionValidationTest, FunctionEndWithoutReturnStatement_Fail) {
|
||||
|
||||
auto* var = Var("a", ty.i32(), ast::StorageClass::kNone, Expr(2));
|
||||
|
||||
Func(Source{Source::Location{12, 34}}, "func", ast::VariableList{}, ty.i32(),
|
||||
Func(Source{{12, 34}}, "func", ast::VariableList{}, ty.i32(),
|
||||
ast::StatementList{
|
||||
Decl(var),
|
||||
},
|
||||
@@ -259,8 +258,8 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
VoidFunctionEndWithoutReturnStatementEmptyBody_Pass) {
|
||||
// fn func {}
|
||||
|
||||
Func(Source{Source::Location{12, 34}}, "func", ast::VariableList{},
|
||||
ty.void_(), ast::StatementList{});
|
||||
Func(Source{{12, 34}}, "func", ast::VariableList{}, ty.void_(),
|
||||
ast::StatementList{});
|
||||
|
||||
EXPECT_TRUE(r()->Resolve()) << r()->error();
|
||||
}
|
||||
@@ -269,7 +268,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
FunctionEndWithoutReturnStatementEmptyBody_Fail) {
|
||||
// fn func() -> int {}
|
||||
|
||||
Func(Source{Source::Location{12, 34}}, "func", ast::VariableList{}, ty.i32(),
|
||||
Func(Source{{12, 34}}, "func", ast::VariableList{}, ty.i32(),
|
||||
ast::StatementList{}, ast::DecorationList{});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -294,7 +293,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
// fn func { return 2; }
|
||||
Func("func", ast::VariableList{}, ty.void_(),
|
||||
ast::StatementList{
|
||||
Return(Source{Source::Location{12, 34}}, Expr(2)),
|
||||
Return(Source{{12, 34}}, Expr(2)),
|
||||
},
|
||||
ast::DecorationList{});
|
||||
|
||||
@@ -311,7 +310,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
Func("v", {}, ty.void_(), {Return()});
|
||||
Func("func", {}, ty.void_(),
|
||||
{
|
||||
Return(Call(Source{Source::Location{12, 34}}, "v")),
|
||||
Return(Call(Source{{12, 34}}, "v")),
|
||||
});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -323,7 +322,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
// fn func() -> f32 { return; }
|
||||
Func("func", ast::VariableList{}, ty.f32(),
|
||||
ast::StatementList{
|
||||
Return(Source{Source::Location{12, 34}}, nullptr),
|
||||
Return(Source{{12, 34}}, nullptr),
|
||||
},
|
||||
ast::DecorationList{});
|
||||
|
||||
@@ -338,7 +337,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
// fn func() -> f32 { return 2.0; }
|
||||
Func("func", ast::VariableList{}, ty.f32(),
|
||||
ast::StatementList{
|
||||
Return(Source{Source::Location{12, 34}}, Expr(2.f)),
|
||||
Return(Source{{12, 34}}, Expr(2.f)),
|
||||
},
|
||||
ast::DecorationList{});
|
||||
|
||||
@@ -350,7 +349,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
// fn func() -> f32 { return 2; }
|
||||
Func("func", ast::VariableList{}, ty.f32(),
|
||||
ast::StatementList{
|
||||
Return(Source{Source::Location{12, 34}}, Expr(2)),
|
||||
Return(Source{{12, 34}}, Expr(2)),
|
||||
},
|
||||
ast::DecorationList{});
|
||||
|
||||
@@ -367,7 +366,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
auto* myf32 = Alias("myf32", ty.f32());
|
||||
Func("func", ast::VariableList{}, ty.Of(myf32),
|
||||
ast::StatementList{
|
||||
Return(Source{Source::Location{12, 34}}, Expr(2.f)),
|
||||
Return(Source{{12, 34}}, Expr(2.f)),
|
||||
},
|
||||
ast::DecorationList{});
|
||||
|
||||
@@ -381,7 +380,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
auto* myf32 = Alias("myf32", ty.f32());
|
||||
Func("func", ast::VariableList{}, ty.Of(myf32),
|
||||
ast::StatementList{
|
||||
Return(Source{Source::Location{12, 34}}, Expr(2u)),
|
||||
Return(Source{{12, 34}}, Expr(2u)),
|
||||
},
|
||||
ast::DecorationList{});
|
||||
|
||||
@@ -413,8 +412,7 @@ TEST_F(ResolverFunctionValidationTest, PipelineStage_MustBeUnique_Fail) {
|
||||
// [[stage(fragment)]]
|
||||
// [[stage(vertex)]]
|
||||
// fn main() { return; }
|
||||
Func(Source{Source::Location{12, 34}}, "main", ast::VariableList{},
|
||||
ty.void_(),
|
||||
Func(Source{{12, 34}}, "main", ast::VariableList{}, ty.void_(),
|
||||
ast::StatementList{
|
||||
Return(),
|
||||
},
|
||||
@@ -537,7 +535,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch) {
|
||||
GlobalConst("x", ty.u32(), Expr(64u));
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(Expr(1), Expr(Source{Source::Location{12, 34}}, "x"))});
|
||||
WorkgroupSize(Expr(1), Expr(Source{{12, 34}}, "x"))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -554,7 +552,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_TypeMismatch2) {
|
||||
GlobalConst("y", ty.i32(), Expr(32));
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(Expr("x"), Expr(Source{Source::Location{12, 34}}, "y"))});
|
||||
WorkgroupSize(Expr("x"), Expr(Source{{12, 34}}, "y"))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -570,8 +568,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Mismatch_ConstU32) {
|
||||
GlobalConst("y", ty.u32(), Expr(8u));
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(Expr("x"), Expr("y"),
|
||||
Expr(Source{Source::Location{12, 34}}, 16))});
|
||||
WorkgroupSize(Expr("x"), Expr("y"), Expr(Source{{12, 34}}, 16))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -585,8 +582,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_BadType) {
|
||||
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(create<ast::ScalarConstructorExpression>(
|
||||
Source{Source::Location{12, 34}}, Literal(64.f)))});
|
||||
WorkgroupSize(Literal(Source{{12, 34}}, 64.f))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -600,8 +596,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Negative) {
|
||||
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(create<ast::ScalarConstructorExpression>(
|
||||
Source{Source::Location{12, 34}}, Literal(-2)))});
|
||||
WorkgroupSize(Literal(Source{{12, 34}}, -2))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -614,8 +609,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Literal_Zero) {
|
||||
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(create<ast::ScalarConstructorExpression>(
|
||||
Source{Source::Location{12, 34}}, Literal(0)))});
|
||||
WorkgroupSize(Literal(Source{{12, 34}}, 0))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -629,7 +623,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_BadType) {
|
||||
GlobalConst("x", ty.f32(), Expr(64.f));
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(Expr(Source{Source::Location{12, 34}}, "x"))});
|
||||
WorkgroupSize(Expr(Source{{12, 34}}, "x"))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -644,7 +638,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Negative) {
|
||||
GlobalConst("x", ty.i32(), Expr(-2));
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(Expr(Source{Source::Location{12, 34}}, "x"))});
|
||||
WorkgroupSize(Expr(Source{{12, 34}}, "x"))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -658,7 +652,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_Const_Zero) {
|
||||
GlobalConst("x", ty.i32(), Expr(0));
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(Expr(Source{Source::Location{12, 34}}, "x"))});
|
||||
WorkgroupSize(Expr(Source{{12, 34}}, "x"))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -674,7 +668,7 @@ TEST_F(ResolverFunctionValidationTest,
|
||||
Construct(ty.i32(), Construct(ty.i32(), Construct(ty.i32()))));
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(Expr(Source{Source::Location{12, 34}}, "x"))});
|
||||
WorkgroupSize(Expr(Source{{12, 34}}, "x"))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -688,7 +682,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_NonConst) {
|
||||
Global("x", ty.i32(), ast::StorageClass::kPrivate, Expr(64));
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(Expr(Source{Source::Location{12, 34}}, "x"))});
|
||||
WorkgroupSize(Expr(Source{{12, 34}}, "x"))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
@@ -701,8 +695,7 @@ TEST_F(ResolverFunctionValidationTest, WorkgroupSize_InvalidExpr) {
|
||||
// fn main() {}
|
||||
Func("main", {}, ty.void_(), {},
|
||||
{Stage(ast::PipelineStage::kCompute),
|
||||
WorkgroupSize(
|
||||
Construct(Source{Source::Location{12, 34}}, ty.i32(), 1))});
|
||||
WorkgroupSize(Construct(Source{{12, 34}}, ty.i32(), 1))});
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
EXPECT_EQ(r()->error(),
|
||||
|
||||
@@ -2015,7 +2015,7 @@ bool Resolver::WorkgroupSizeFor(const ast::Function* func,
|
||||
ws[i].value = 0;
|
||||
continue;
|
||||
}
|
||||
} else if (!expr->Is<ast::ScalarConstructorExpression>()) {
|
||||
} else if (!expr->Is<ast::Literal>()) {
|
||||
AddError(
|
||||
"workgroup_size argument must be either a literal or a "
|
||||
"module-scope constant",
|
||||
@@ -2366,6 +2366,8 @@ sem::Expression* Resolver::Expression(const ast::Expression* root) {
|
||||
sem_expr = Constructor(ctor);
|
||||
} else if (auto* ident = expr->As<ast::IdentifierExpression>()) {
|
||||
sem_expr = Identifier(ident);
|
||||
} else if (auto* literal = expr->As<ast::Literal>()) {
|
||||
sem_expr = Literal(literal);
|
||||
} else if (auto* member = expr->As<ast::MemberAccessorExpression>()) {
|
||||
sem_expr = MemberAccessor(member);
|
||||
} else if (auto* unary = expr->As<ast::UnaryOpExpression>()) {
|
||||
@@ -2421,8 +2423,7 @@ sem::Expression* Resolver::ArrayAccessor(
|
||||
if (!parent_raw_ty->Is<sem::Reference>()) {
|
||||
// TODO(bclayton): expand this to allow any const_expr expression
|
||||
// https://github.com/gpuweb/gpuweb/issues/1272
|
||||
auto* scalar = idx->As<ast::ScalarConstructorExpression>();
|
||||
if (!scalar || !scalar->literal->As<ast::IntLiteral>()) {
|
||||
if (!idx->As<ast::IntLiteral>()) {
|
||||
AddError("index must be signed or unsigned integer literal",
|
||||
idx->source);
|
||||
return nullptr;
|
||||
@@ -2615,8 +2616,7 @@ bool Resolver::ValidateTextureIntrinsicFunction(const sem::Call* call) {
|
||||
bool is_const_expr = true;
|
||||
ast::TraverseExpressions(
|
||||
arg->Declaration(), diagnostics_, [&](const ast::Expression* e) {
|
||||
if (e->IsAnyOf<ast::ScalarConstructorExpression,
|
||||
ast::TypeConstructorExpression>()) {
|
||||
if (e->IsAnyOf<ast::Literal, ast::TypeConstructorExpression>()) {
|
||||
return ast::TraverseAction::Descend;
|
||||
}
|
||||
is_const_expr = false;
|
||||
@@ -2763,21 +2763,21 @@ sem::Expression* Resolver::Constructor(const ast::ConstructorExpression* expr) {
|
||||
return builder_->create<sem::Expression>(expr, ty, current_statement_, val);
|
||||
}
|
||||
|
||||
if (auto* scalar_ctor = expr->As<ast::ScalarConstructorExpression>()) {
|
||||
Mark(scalar_ctor->literal);
|
||||
auto* ty = TypeOf(scalar_ctor->literal);
|
||||
if (!ty) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto val = EvaluateConstantValue(expr, ty);
|
||||
return builder_->create<sem::Expression>(expr, ty, current_statement_, val);
|
||||
}
|
||||
|
||||
TINT_ICE(Resolver, diagnostics_) << "unexpected constructor expression type";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sem::Expression* Resolver::Literal(const ast::Literal* literal) {
|
||||
auto* ty = TypeOf(literal);
|
||||
if (!ty) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto val = EvaluateConstantValue(literal, ty);
|
||||
return builder_->create<sem::Expression>(literal, ty, current_statement_,
|
||||
val);
|
||||
}
|
||||
|
||||
bool Resolver::ValidateStructureConstructor(
|
||||
const ast::TypeConstructorExpression* ctor,
|
||||
const sem::Struct* struct_type) {
|
||||
@@ -3783,7 +3783,7 @@ sem::Array* Resolver::Array(const ast::Array* arr) {
|
||||
}
|
||||
|
||||
count_expr = var->Declaration()->constructor;
|
||||
} else if (!count_expr->Is<ast::ScalarConstructorExpression>()) {
|
||||
} else if (!count_expr->Is<ast::Literal>()) {
|
||||
AddError(
|
||||
"array size expression must be either a literal or a module-scope "
|
||||
"constant",
|
||||
|
||||
@@ -177,6 +177,7 @@ class Resolver {
|
||||
sem::Call* FunctionCall(const ast::CallExpression*);
|
||||
sem::Expression* Identifier(const ast::IdentifierExpression*);
|
||||
sem::Call* IntrinsicCall(const ast::CallExpression*, sem::IntrinsicType);
|
||||
sem::Expression* Literal(const ast::Literal*);
|
||||
sem::Expression* MemberAccessor(const ast::MemberAccessorExpression*);
|
||||
sem::Expression* UnaryOp(const ast::UnaryOpExpression*);
|
||||
|
||||
@@ -375,9 +376,8 @@ class Resolver {
|
||||
|
||||
sem::Constant EvaluateConstantValue(const ast::Expression* expr,
|
||||
const sem::Type* type);
|
||||
sem::Constant EvaluateConstantValue(
|
||||
const ast::ScalarConstructorExpression* scalar_ctor,
|
||||
const sem::Type* type);
|
||||
sem::Constant EvaluateConstantValue(const ast::Literal* literal,
|
||||
const sem::Type* type);
|
||||
sem::Constant EvaluateConstantValue(
|
||||
const ast::TypeConstructorExpression* type_ctor,
|
||||
const sem::Type* type);
|
||||
|
||||
@@ -29,7 +29,7 @@ using f32 = ProgramBuilder::f32;
|
||||
|
||||
sem::Constant Resolver::EvaluateConstantValue(const ast::Expression* expr,
|
||||
const sem::Type* type) {
|
||||
if (auto* e = expr->As<ast::ScalarConstructorExpression>()) {
|
||||
if (auto* e = expr->As<ast::Literal>()) {
|
||||
return EvaluateConstantValue(e, type);
|
||||
}
|
||||
if (auto* e = expr->As<ast::TypeConstructorExpression>()) {
|
||||
@@ -38,10 +38,8 @@ sem::Constant Resolver::EvaluateConstantValue(const ast::Expression* expr,
|
||||
return {};
|
||||
}
|
||||
|
||||
sem::Constant Resolver::EvaluateConstantValue(
|
||||
const ast::ScalarConstructorExpression* scalar_ctor,
|
||||
const sem::Type* type) {
|
||||
auto* literal = scalar_ctor->literal;
|
||||
sem::Constant Resolver::EvaluateConstantValue(const ast::Literal* literal,
|
||||
const sem::Type* type) {
|
||||
if (auto* lit = literal->As<ast::SintLiteral>()) {
|
||||
return {type, {lit->ValueAsI32()}};
|
||||
}
|
||||
|
||||
@@ -424,10 +424,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Array_type_match) {
|
||||
// array<u32, 3>(0u, 10u. 20u);
|
||||
auto* tc =
|
||||
array<u32, 3>(create<ast::ScalarConstructorExpression>(Literal(0u)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(10u)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(20u)));
|
||||
auto* tc = array<u32, 3>(Literal(0u), Literal(10u), Literal(20u));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_TRUE(r()->Resolve());
|
||||
@@ -436,10 +433,8 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Array_type_Mismatch_U32F32) {
|
||||
// array<u32, 3>(0u, 1.0f, 20u);
|
||||
auto* tc = array<u32, 3>(
|
||||
create<ast::ScalarConstructorExpression>(Literal(0u)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(20u)));
|
||||
auto* tc =
|
||||
array<u32, 3>(Literal(0u), Literal(Source{{12, 34}}, 1.0f), Literal(20u));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -451,8 +446,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Array_ScalarArgumentTypeMismatch_F32I32) {
|
||||
// array<f32, 1>(1);
|
||||
auto* tc = array<f32, 1>(
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1)));
|
||||
auto* tc = array<f32, 1>(Literal(Source{{12, 34}}, 1));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -464,12 +458,8 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Array_ScalarArgumentTypeMismatch_U32I32) {
|
||||
// array<u32, 6>(1, 0u, 0u, 0u, 0u, 0u);
|
||||
auto* tc = array<u32, 1>(
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(0u)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(0u)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(0u)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(0u)));
|
||||
auto* tc = array<u32, 1>(Literal(Source{{12, 34}}, 1), Literal(0u),
|
||||
Literal(0u), Literal(0u), Literal(0u));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -481,7 +471,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Array_ScalarArgumentTypeMismatch_Vec2) {
|
||||
// array<i32, 3>(1, vec2<i32>());
|
||||
auto* tc = array<i32, 3>(create<ast::ScalarConstructorExpression>(Literal(1)),
|
||||
auto* tc = array<i32, 3>(Literal(1),
|
||||
create<ast::TypeConstructorExpression>(
|
||||
Source{{12, 34}}, ty.vec2<i32>(), ExprList()));
|
||||
WrapInFunction(tc);
|
||||
@@ -555,10 +545,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Array_TooFewElements) {
|
||||
// array<i32, 4>(1, 2, 3);
|
||||
SetSource(Source::Location({12, 34}));
|
||||
auto* tc =
|
||||
array<i32, 4>(create<ast::ScalarConstructorExpression>(Literal(1)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(2)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(3)));
|
||||
auto* tc = array<i32, 4>(Literal(1), Literal(2), Literal(3));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -572,11 +559,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
// array<i32, 4>(1, 2, 3, 4, 5);
|
||||
SetSource(Source::Location({12, 34}));
|
||||
auto* tc =
|
||||
array<i32, 4>(create<ast::ScalarConstructorExpression>(Literal(1)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(2)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(3)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(4)),
|
||||
create<ast::ScalarConstructorExpression>(Literal(5)));
|
||||
array<i32, 4>(Literal(1), Literal(2), Literal(3), Literal(4), Literal(5));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -588,9 +571,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest, Expr_Constructor_Array_Runtime) {
|
||||
// array<i32>(1);
|
||||
auto* tc = array(
|
||||
ty.i32(), nullptr,
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1)));
|
||||
auto* tc = array(ty.i32(), nullptr, Literal(Source{{12, 34}}, 1));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -613,9 +594,7 @@ namespace VectorConstructor {
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec2F32_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec2<f32>(
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1)),
|
||||
1.0f);
|
||||
auto* tc = vec2<f32>(Literal(Source{{12, 34}}, 1), 1.0f);
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -626,8 +605,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec2U32_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec2<u32>(1u, create<ast::ScalarConstructorExpression>(
|
||||
Source{{12, 34}}, Literal(1)));
|
||||
auto* tc = vec2<u32>(1u, Literal(Source{{12, 34}}, 1));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -638,9 +616,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec2I32_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec2<i32>(
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1u)),
|
||||
1);
|
||||
auto* tc = vec2<i32>(Literal(Source{{12, 34}}, 1u), 1);
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -651,8 +627,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec2Bool_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec2<bool>(true, create<ast::ScalarConstructorExpression>(
|
||||
Source{{12, 34}}, Literal(1)));
|
||||
auto* tc = vec2<bool>(true, Literal(Source{{12, 34}}, 1));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -687,11 +662,9 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec2_Error_TooManyArgumentsScalar) {
|
||||
auto* tc = vec2<f32>(
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 40}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 46}},
|
||||
Literal(1.0f)));
|
||||
auto* tc = vec2<f32>(Literal(Source{{12, 34}}, 1.0f),
|
||||
Literal(Source{{12, 40}}, 1.0f),
|
||||
Literal(Source{{12, 46}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -718,8 +691,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec2_Error_TooManyArgumentsVectorAndScalar) {
|
||||
auto* tc = vec2<f32>(create<ast::TypeConstructorExpression>(
|
||||
Source{{12, 34}}, ty.vec2<f32>(), ExprList()),
|
||||
create<ast::ScalarConstructorExpression>(
|
||||
Source{{12, 40}}, Literal(1.0f)));
|
||||
Literal(Source{{12, 40}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -833,9 +805,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec3F32_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec3<f32>(
|
||||
1.0f, 1.0f,
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1)));
|
||||
auto* tc = vec3<f32>(1.0f, 1.0f, Literal(Source{{12, 34}}, 1));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -846,10 +816,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec3U32_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec3<u32>(
|
||||
1u,
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1)),
|
||||
1u);
|
||||
auto* tc = vec3<u32>(1u, Literal(Source{{12, 34}}, 1), 1u);
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -860,10 +827,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec3I32_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec3<i32>(
|
||||
1,
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1u)),
|
||||
1);
|
||||
auto* tc = vec3<i32>(1, Literal(Source{{12, 34}}, 1u), 1);
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -874,10 +838,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec3Bool_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec3<bool>(
|
||||
true,
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1)),
|
||||
false);
|
||||
auto* tc = vec3<bool>(true, Literal(Source{{12, 34}}, 1), false);
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -900,10 +861,8 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec3_Error_TooFewArgumentsScalar) {
|
||||
auto* tc = vec3<f32>(
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 40}},
|
||||
Literal(1.0f)));
|
||||
auto* tc = vec3<f32>(Literal(Source{{12, 34}}, 1.0f),
|
||||
Literal(Source{{12, 40}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -915,11 +874,8 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec3_Error_TooManyArgumentsScalar) {
|
||||
auto* tc = vec3<f32>(
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 40}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 46}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 52}},
|
||||
Literal(1.0f)));
|
||||
Literal(Source{{12, 34}}, 1.0f), Literal(Source{{12, 40}}, 1.0f),
|
||||
Literal(Source{{12, 46}}, 1.0f), Literal(Source{{12, 52}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -956,12 +912,10 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec3_Error_TooManyArgumentsVec2AndScalar) {
|
||||
auto* tc = vec3<f32>(
|
||||
create<ast::TypeConstructorExpression>(Source{{12, 34}}, ty.vec2<f32>(),
|
||||
ExprList()),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 40}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 46}},
|
||||
Literal(1.0f)));
|
||||
auto* tc = vec3<f32>(create<ast::TypeConstructorExpression>(
|
||||
Source{{12, 34}}, ty.vec2<f32>(), ExprList()),
|
||||
Literal(Source{{12, 40}}, 1.0f),
|
||||
Literal(Source{{12, 46}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -974,8 +928,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec3_Error_TooManyArgumentsVec3) {
|
||||
auto* tc = vec3<f32>(create<ast::TypeConstructorExpression>(
|
||||
Source{{12, 34}}, ty.vec3<f32>(), ExprList()),
|
||||
create<ast::ScalarConstructorExpression>(
|
||||
Source{{12, 40}}, Literal(1.0f)));
|
||||
Literal(Source{{12, 40}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1115,10 +1068,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec4F32_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec4<f32>(
|
||||
1.0f, 1.0f,
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1)),
|
||||
1.0f);
|
||||
auto* tc = vec4<f32>(1.0f, 1.0f, Literal(Source{{12, 34}}, 1), 1.0f);
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1129,10 +1079,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec4U32_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec4<u32>(
|
||||
1u, 1u,
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1)),
|
||||
1u);
|
||||
auto* tc = vec4<u32>(1u, 1u, Literal(Source{{12, 34}}, 1), 1u);
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1143,10 +1090,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec4I32_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec4<i32>(
|
||||
1, 1,
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1u)),
|
||||
1);
|
||||
auto* tc = vec4<i32>(1, 1, Literal(Source{{12, 34}}, 1u), 1);
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1157,10 +1101,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec4Bool_Error_ScalarArgumentTypeMismatch) {
|
||||
auto* tc = vec4<bool>(
|
||||
true, false,
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1)),
|
||||
true);
|
||||
auto* tc = vec4<bool>(true, false, Literal(Source{{12, 34}}, 1), true);
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1171,11 +1112,9 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec4_Error_TooFewArgumentsScalar) {
|
||||
auto* tc = vec4<f32>(
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 40}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 46}},
|
||||
Literal(1.0f)));
|
||||
auto* tc = vec4<f32>(Literal(Source{{12, 34}}, 1.0f),
|
||||
Literal(Source{{12, 40}}, 1.0f),
|
||||
Literal(Source{{12, 46}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1187,12 +1126,9 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec4_Error_TooManyArgumentsScalar) {
|
||||
auto* tc = vec4<f32>(
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 34}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 40}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 46}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 52}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 58}},
|
||||
Literal(1.0f)));
|
||||
Literal(Source{{12, 34}}, 1.0f), Literal(Source{{12, 40}}, 1.0f),
|
||||
Literal(Source{{12, 46}}, 1.0f), Literal(Source{{12, 52}}, 1.0f),
|
||||
Literal(Source{{12, 58}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1205,8 +1141,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec4_Error_TooFewArgumentsVec2AndScalar) {
|
||||
auto* tc = vec4<f32>(create<ast::TypeConstructorExpression>(
|
||||
Source{{12, 34}}, ty.vec2<f32>(), ExprList()),
|
||||
create<ast::ScalarConstructorExpression>(
|
||||
Source{{12, 40}}, Literal(1.0f)));
|
||||
Literal(Source{{12, 40}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1217,13 +1152,11 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec4_Error_TooManyArgumentsVec2AndScalars) {
|
||||
auto* tc = vec4<f32>(
|
||||
create<ast::TypeConstructorExpression>(Source{{12, 34}}, ty.vec2<f32>(),
|
||||
ExprList()),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 40}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 46}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 52}},
|
||||
Literal(1.0f)));
|
||||
auto* tc = vec4<f32>(create<ast::TypeConstructorExpression>(
|
||||
Source{{12, 34}}, ty.vec2<f32>(), ExprList()),
|
||||
Literal(Source{{12, 40}}, 1.0f),
|
||||
Literal(Source{{12, 46}}, 1.0f),
|
||||
Literal(Source{{12, 52}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1238,8 +1171,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Source{{12, 34}}, ty.vec2<f32>(), ExprList()),
|
||||
create<ast::TypeConstructorExpression>(
|
||||
Source{{12, 40}}, ty.vec2<f32>(), ExprList()),
|
||||
create<ast::ScalarConstructorExpression>(
|
||||
Source{{12, 46}}, Literal(1.0f)));
|
||||
Literal(Source{{12, 46}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1278,12 +1210,10 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
|
||||
TEST_F(ResolverTypeConstructorValidationTest,
|
||||
Expr_Constructor_Vec4_Error_TooManyArgumentsVec3AndScalars) {
|
||||
auto* tc = vec4<f32>(
|
||||
create<ast::TypeConstructorExpression>(Source{{12, 34}}, ty.vec3<f32>(),
|
||||
ExprList()),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 40}}, Literal(1.0f)),
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, 46}},
|
||||
Literal(1.0f)));
|
||||
auto* tc = vec4<f32>(create<ast::TypeConstructorExpression>(
|
||||
Source{{12, 34}}, ty.vec3<f32>(), ExprList()),
|
||||
Literal(Source{{12, 40}}, 1.0f),
|
||||
Literal(Source{{12, 46}}, 1.0f));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1576,8 +1506,7 @@ TEST_F(ResolverTypeConstructorValidationTest,
|
||||
auto* vec_type = ty.vec(ty.Of(f32_alias), 2);
|
||||
auto* tc = create<ast::TypeConstructorExpression>(
|
||||
Source{{12, 34}}, vec_type,
|
||||
ExprList(1.0f, create<ast::ScalarConstructorExpression>(Source{{12, 40}},
|
||||
Literal(1u))));
|
||||
ExprList(1.0f, Literal(Source{{12, 40}}, 1u)));
|
||||
WrapInFunction(tc);
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
@@ -1767,8 +1696,7 @@ TEST_P(MatrixConstructorTest,
|
||||
|
||||
ast::ExpressionList args;
|
||||
for (uint32_t i = 1; i <= param.columns; i++) {
|
||||
args.push_back(
|
||||
create<ast::ScalarConstructorExpression>(Source{{12, i}}, Literal(1u)));
|
||||
args.push_back(Literal(Source{{12, i}}, 1u));
|
||||
}
|
||||
|
||||
auto* matrix_type = ty.mat<f32>(param.columns, param.rows);
|
||||
|
||||
@@ -129,9 +129,7 @@ TEST_F(ResolverValidationTest, Stmt_Error_Unknown) {
|
||||
TEST_F(ResolverValidationTest, Stmt_If_NonBool) {
|
||||
// if (1.23f) {}
|
||||
|
||||
WrapInFunction(If(create<ast::ScalarConstructorExpression>(Source{{12, 34}},
|
||||
Literal(1.23f)),
|
||||
Block()));
|
||||
WrapInFunction(If(Literal(Source{{12, 34}}, 1.23f), Block()));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
||||
@@ -142,10 +140,8 @@ TEST_F(ResolverValidationTest, Stmt_If_NonBool) {
|
||||
TEST_F(ResolverValidationTest, Stmt_Else_NonBool) {
|
||||
// else (1.23f) {}
|
||||
|
||||
WrapInFunction(If(Expr(true), Block(),
|
||||
Else(create<ast::ScalarConstructorExpression>(
|
||||
Source{{12, 34}}, Literal(1.23f)),
|
||||
Block())));
|
||||
WrapInFunction(
|
||||
If(Expr(true), Block(), Else(Literal(Source{{12, 34}}, 1.23f), Block())));
|
||||
|
||||
EXPECT_FALSE(r()->Resolve());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user