chromium/third_party/dawn/src/tint/lang/wgsl/resolver/variable_test.cc

// Copyright 2021 The Dawn & Tint Authors
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
//    list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
//    this list of conditions and the following disclaimer in the documentation
//    and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its
//    contributors may be used to endorse or promote products derived from
//    this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "gmock/gmock.h"
#include "src/tint/lang/core/type/reference.h"
#include "src/tint/lang/core/type/texture_dimension.h"
#include "src/tint/lang/wgsl/resolver/resolver.h"
#include "src/tint/lang/wgsl/resolver/resolver_helper_test.h"

namespace tint::resolver {
namespace {

usingnamespacetint::core::fluent_types;     // NOLINT
usingnamespacetint::core::number_suffixes;  // NOLINT

struct ResolverVariableTest : public resolver::TestHelper, public testing::Test {};

////////////////////////////////////////////////////////////////////////////////////////////////////
// Function-scope 'var'
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ResolverVariableTest, LocalVar_NoInitializer) {}

TEST_F(ResolverVariableTest, LocalVar_WithInitializer) {}

TEST_F(ResolverVariableTest, LocalVar_ShadowsAlias) {}

TEST_F(ResolverVariableTest, LocalVar_ShadowsStruct) {}

TEST_F(ResolverVariableTest, LocalVar_ShadowsFunction) {}

TEST_F(ResolverVariableTest, LocalVar_ShadowsGlobalVar) {}

TEST_F(ResolverVariableTest, LocalVar_ShadowsGlobalConst) {}

TEST_F(ResolverVariableTest, LocalVar_ShadowsLocalVar) {}

TEST_F(ResolverVariableTest, LocalVar_ShadowsLocalConst) {}

TEST_F(ResolverVariableTest, LocalVar_ShadowsLocalLet) {}

TEST_F(ResolverVariableTest, LocalVar_ShadowsParam) {}

////////////////////////////////////////////////////////////////////////////////////////////////////
// 'let' declaration
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ResolverVariableTest, LocalLet) {}

TEST_F(ResolverVariableTest, LocalLet_InheritsAccessFromOriginatingVariable) {}

TEST_F(ResolverVariableTest, LocalLet_ShadowsAlias) {}

TEST_F(ResolverVariableTest, LocalLet_ShadowsStruct) {}

TEST_F(ResolverVariableTest, LocalLet_ShadowsFunction) {}

TEST_F(ResolverVariableTest, LocalLet_ShadowsGlobalVar) {}

TEST_F(ResolverVariableTest, LocalLet_ShadowsGlobalConst) {}

TEST_F(ResolverVariableTest, LocalLet_ShadowsLocalVar) {}

TEST_F(ResolverVariableTest, LocalLet_ShadowsLocalConst) {}

TEST_F(ResolverVariableTest, LocalLet_ShadowsLocalLet) {}

TEST_F(ResolverVariableTest, LocalLet_ShadowsParam) {}

////////////////////////////////////////////////////////////////////////////////////////////////////
// Function-scope const
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ResolverVariableTest, LocalConst_ShadowsAlias) {}

TEST_F(ResolverVariableTest, LocalConst_ShadowsStruct) {}

TEST_F(ResolverVariableTest, LocalConst_ShadowsFunction) {}

TEST_F(ResolverVariableTest, LocalConst_ShadowsGlobalVar) {}

TEST_F(ResolverVariableTest, LocalConst_ShadowsGlobalConst) {}

TEST_F(ResolverVariableTest, LocalConst_ShadowsLocalVar) {}

TEST_F(ResolverVariableTest, LocalConst_ShadowsLocalConst) {}

TEST_F(ResolverVariableTest, LocalConst_ShadowsLocalLet) {}

TEST_F(ResolverVariableTest, LocalConst_ShadowsParam) {}

TEST_F(ResolverVariableTest, LocalConst_ExplicitType_Decls) {}

TEST_F(ResolverVariableTest, LocalConst_ImplicitType_Decls) {}

TEST_F(ResolverVariableTest, LocalConst_PropagateConstValue) {}

TEST_F(ResolverVariableTest, LocalConst_ConstEval) {}

////////////////////////////////////////////////////////////////////////////////////////////////////
// Module-scope 'var'
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ResolverVariableTest, GlobalVar_AddressSpace) {}

TEST_F(ResolverVariableTest, GlobalVar_ExplicitAddressSpace) {}

////////////////////////////////////////////////////////////////////////////////////////////////////
// Module-scope const
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ResolverVariableTest, GlobalConst_ExplicitType_Decls) {}

TEST_F(ResolverVariableTest, GlobalConst_ImplicitType_Decls) {}

TEST_F(ResolverVariableTest, GlobalConst_PropagateConstValue) {}

TEST_F(ResolverVariableTest, GlobalConst_ConstEval) {}

////////////////////////////////////////////////////////////////////////////////////////////////////
// Function parameter
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ResolverVariableTest, Param_ShadowsFunction) {}

TEST_F(ResolverVariableTest, Param_ShadowsGlobalVar) {}

TEST_F(ResolverVariableTest, Param_ShadowsGlobalConst) {}

TEST_F(ResolverVariableTest, Param_ShadowsAlias) {}

////////////////////////////////////////////////////////////////////////////////////////////////////
// Templated identifier uses
////////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ResolverVariableTest, GlobalVar_UseTemplatedIdent) {}

TEST_F(ResolverVariableTest, GlobalConst_UseTemplatedIdent) {}

TEST_F(ResolverVariableTest, GlobalOverride_UseTemplatedIdent) {}

TEST_F(ResolverVariableTest, Param_UseTemplatedIdent) {}

TEST_F(ResolverVariableTest, LocalVar_UseTemplatedIdent) {}

TEST_F(ResolverVariableTest, Let_UseTemplatedIdent) {}

}  // namespace
}  // namespace tint::resolver