tint: Deprecated module-scope 'let' for 'const'

Enable the parsing of 'const'.
Warn on use of module-scope 'let', and automatically replace with 'const'.

Fixed: tint:1580
Change-Id: I214aabca80686dc6b60ae21a7a57fbfb4898ea83
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93786
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/test/tint/let/global/global.wgsl b/test/tint/let/global/global.wgsl
deleted file mode 100644
index 6639d5d..0000000
--- a/test/tint/let/global/global.wgsl
+++ /dev/null
@@ -1,24 +0,0 @@
-struct MyStruct {
-    f1 : f32,
-};
-
-type MyArray = array<f32, 10>;
-
-// Global lets
-let v1 = 1;
-let v2 = 1u;
-let v3 = 1.0;
-
-let v4 = vec3<i32>(1, 1, 1);
-let v5 = vec3<u32>(1u, 1u, 1u);
-let v6 = vec3<f32>(1.0, 1.0, 1.0);
-
-let v7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
-
-let v8 = MyStruct();
-let v9 = MyArray();
-
-@fragment
-fn main() -> @location(0) vec4<f32> {
-    return vec4<f32>(0.0,0.0,0.0,0.0);
-}
diff --git a/test/tint/let/global/global.wgsl.expected.glsl b/test/tint/let/global/global.wgsl.expected.glsl
deleted file mode 100644
index b350456..0000000
--- a/test/tint/let/global/global.wgsl.expected.glsl
+++ /dev/null
@@ -1,17 +0,0 @@
-#version 310 es
-precision mediump float;
-
-layout(location = 0) out vec4 value;
-struct MyStruct {
-  float f1;
-};
-
-vec4 tint_symbol() {
-  return vec4(0.0f);
-}
-
-void main() {
-  vec4 inner_result = tint_symbol();
-  value = inner_result;
-  return;
-}
diff --git a/test/tint/let/global/global.wgsl.expected.hlsl b/test/tint/let/global/global.wgsl.expected.hlsl
deleted file mode 100644
index 2b62ccc..0000000
--- a/test/tint/let/global/global.wgsl.expected.hlsl
+++ /dev/null
@@ -1,28 +0,0 @@
-struct MyStruct {
-  float f1;
-};
-
-static const int v1 = 1;
-static const uint v2 = 1u;
-static const float v3 = 1.0f;
-static const int3 v4 = (1).xxx;
-static const uint3 v5 = (1u).xxx;
-static const float3 v6 = (1.0f).xxx;
-static const float3x3 v7 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx);
-static const MyStruct v8 = (MyStruct)0;
-static const float v9[10] = (float[10])0;
-
-struct tint_symbol {
-  float4 value : SV_Target0;
-};
-
-float4 main_inner() {
-  return (0.0f).xxxx;
-}
-
-tint_symbol main() {
-  const float4 inner_result = main_inner();
-  tint_symbol wrapper_result = (tint_symbol)0;
-  wrapper_result.value = inner_result;
-  return wrapper_result;
-}
diff --git a/test/tint/let/global/global.wgsl.expected.msl b/test/tint/let/global/global.wgsl.expected.msl
deleted file mode 100644
index d4ded52..0000000
--- a/test/tint/let/global/global.wgsl.expected.msl
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <metal_stdlib>
-
-using namespace metal;
-
-template<typename T, size_t N>
-struct tint_array {
-    const constant T& operator[](size_t i) const constant { return elements[i]; }
-    device T& operator[](size_t i) device { return elements[i]; }
-    const device T& operator[](size_t i) const device { return elements[i]; }
-    thread T& operator[](size_t i) thread { return elements[i]; }
-    const thread T& operator[](size_t i) const thread { return elements[i]; }
-    threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
-    const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
-    T elements[N];
-};
-
-struct MyStruct {
-  float f1;
-};
-
-constant int v1 = 1;
-
-constant uint v2 = 1u;
-
-constant float v3 = 1.0f;
-
-constant int3 v4 = int3(1);
-
-constant uint3 v5 = uint3(1u);
-
-constant float3 v6 = float3(1.0f);
-
-constant float3x3 v7 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f));
-
-constant MyStruct v8 = {};
-
-constant tint_array<float, 10> v9 = tint_array<float, 10>{};
-
-struct tint_symbol_1 {
-  float4 value [[color(0)]];
-};
-
-float4 tint_symbol_inner() {
-  return float4(0.0f);
-}
-
-fragment tint_symbol_1 tint_symbol() {
-  float4 const inner_result = tint_symbol_inner();
-  tint_symbol_1 wrapper_result = {};
-  wrapper_result.value = inner_result;
-  return wrapper_result;
-}
-
diff --git a/test/tint/let/global/global.wgsl.expected.spvasm b/test/tint/let/global/global.wgsl.expected.spvasm
deleted file mode 100644
index f9c63e2..0000000
--- a/test/tint/let/global/global.wgsl.expected.spvasm
+++ /dev/null
@@ -1,62 +0,0 @@
-; SPIR-V
-; Version: 1.3
-; Generator: Google Tint Compiler; 0
-; Bound: 32
-; Schema: 0
-               OpCapability Shader
-               OpMemoryModel Logical GLSL450
-               OpEntryPoint Fragment %main "main" %value
-               OpExecutionMode %main OriginUpperLeft
-               OpName %value "value"
-               OpName %v1 "v1"
-               OpName %v2 "v2"
-               OpName %v3 "v3"
-               OpName %v4 "v4"
-               OpName %v5 "v5"
-               OpName %v6 "v6"
-               OpName %v7 "v7"
-               OpName %MyStruct "MyStruct"
-               OpMemberName %MyStruct 0 "f1"
-               OpName %v8 "v8"
-               OpName %v9 "v9"
-               OpName %main_inner "main_inner"
-               OpName %main "main"
-               OpDecorate %value Location 0
-               OpMemberDecorate %MyStruct 0 Offset 0
-               OpDecorate %_arr_float_uint_10 ArrayStride 4
-      %float = OpTypeFloat 32
-    %v4float = OpTypeVector %float 4
-%_ptr_Output_v4float = OpTypePointer Output %v4float
-          %5 = OpConstantNull %v4float
-      %value = OpVariable %_ptr_Output_v4float Output %5
-        %int = OpTypeInt 32 1
-         %v1 = OpConstant %int 1
-       %uint = OpTypeInt 32 0
-         %v2 = OpConstant %uint 1
-         %v3 = OpConstant %float 1
-      %v3int = OpTypeVector %int 3
-         %v4 = OpConstantComposite %v3int %v1 %v1 %v1
-     %v3uint = OpTypeVector %uint 3
-         %v5 = OpConstantComposite %v3uint %v2 %v2 %v2
-    %v3float = OpTypeVector %float 3
-         %v6 = OpConstantComposite %v3float %v3 %v3 %v3
-%mat3v3float = OpTypeMatrix %v3float 3
-         %v7 = OpConstantComposite %mat3v3float %v6 %v6 %v6
-   %MyStruct = OpTypeStruct %float
-         %v8 = OpConstantNull %MyStruct
-    %uint_10 = OpConstant %uint 10
-%_arr_float_uint_10 = OpTypeArray %float %uint_10
-         %v9 = OpConstantNull %_arr_float_uint_10
-         %24 = OpTypeFunction %v4float
-       %void = OpTypeVoid
-         %27 = OpTypeFunction %void
- %main_inner = OpFunction %v4float None %24
-         %26 = OpLabel
-               OpReturnValue %5
-               OpFunctionEnd
-       %main = OpFunction %void None %27
-         %30 = OpLabel
-         %31 = OpFunctionCall %v4float %main_inner
-               OpStore %value %31
-               OpReturn
-               OpFunctionEnd
diff --git a/test/tint/let/global/global.wgsl.expected.wgsl b/test/tint/let/global/global.wgsl.expected.wgsl
deleted file mode 100644
index 8f76f49..0000000
--- a/test/tint/let/global/global.wgsl.expected.wgsl
+++ /dev/null
@@ -1,28 +0,0 @@
-struct MyStruct {
-  f1 : f32,
-}
-
-type MyArray = array<f32, 10>;
-
-let v1 = 1;
-
-let v2 = 1u;
-
-let v3 = 1.0;
-
-let v4 = vec3<i32>(1, 1, 1);
-
-let v5 = vec3<u32>(1u, 1u, 1u);
-
-let v6 = vec3<f32>(1.0, 1.0, 1.0);
-
-let v7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
-
-let v8 = MyStruct();
-
-let v9 = MyArray();
-
-@fragment
-fn main() -> @location(0) vec4<f32> {
-  return vec4<f32>(0.0, 0.0, 0.0, 0.0);
-}
diff --git a/test/tint/let/inferred/function.wgsl.expected.hlsl b/test/tint/let/inferred/function.wgsl.expected.hlsl
index 5a75ea6..152e8d1 100644
--- a/test/tint/let/inferred/function.wgsl.expected.hlsl
+++ b/test/tint/let/inferred/function.wgsl.expected.hlsl
@@ -32,7 +32,7 @@
   const int3 v4 = (1).xxx;
   const uint3 v5 = (1u).xxx;
   const float3 v6 = (1.0f).xxx;
-  const float3x3 v7 = float3x3((1.0f).xxx, (1.0f).xxx, (1.0f).xxx);
+  const float3x3 v7 = float3x3(v6, v6, v6);
   const MyStruct v8 = {1.0f};
   const float v9[10] = (float[10])0;
   const int v10 = ret_i32();
diff --git a/test/tint/let/inferred/function.wgsl.expected.msl b/test/tint/let/inferred/function.wgsl.expected.msl
index 604c979..440faea 100644
--- a/test/tint/let/inferred/function.wgsl.expected.msl
+++ b/test/tint/let/inferred/function.wgsl.expected.msl
@@ -47,7 +47,7 @@
   int3 const v4 = int3(1);
   uint3 const v5 = uint3(1u);
   float3 const v6 = float3(1.0f);
-  float3x3 const v7 = float3x3(float3(1.0f), float3(1.0f), float3(1.0f));
+  float3x3 const v7 = float3x3(v6, v6, v6);
   MyStruct const v8 = {.f1=1.0f};
   tint_array<float, 10> const v9 = tint_array<float, 10>{};
   int const v10 = ret_i32();
diff --git a/test/tint/let/inferred/function.wgsl.expected.spvasm b/test/tint/let/inferred/function.wgsl.expected.spvasm
index e3f36f6..6e2ddcb 100644
--- a/test/tint/let/inferred/function.wgsl.expected.spvasm
+++ b/test/tint/let/inferred/function.wgsl.expected.spvasm
@@ -50,7 +50,6 @@
     %v3float = OpTypeVector %float 3
          %40 = OpConstantComposite %v3float %float_1 %float_1 %float_1
 %mat3v3float = OpTypeMatrix %v3float 3
-         %42 = OpConstantComposite %mat3v3float %40 %40 %40
          %43 = OpConstantComposite %MyStruct %float_1
          %50 = OpTypeFunction %v4float
     %ret_i32 = OpFunction %int None %6
@@ -75,6 +74,7 @@
                OpFunctionEnd
   %let_decls = OpFunction %void None %31
          %34 = OpLabel
+         %42 = OpCompositeConstruct %mat3v3float %40 %40 %40
          %44 = OpFunctionCall %int %ret_i32
          %45 = OpFunctionCall %uint %ret_u32
          %46 = OpFunctionCall %float %ret_f32