[tint][intrinsics] Simplify intrinsic table
* Combine the type and number matcher index tables. The usage knows which
kind of matcher is needed.
* Combine the type and number template structures.
* Change the template matcher from a single matcher index, to a list of
matchers. This allows templates to match using other templates.
* Remove the validation forbidding the direct use of a matcher in a
parameter. While this is discouraged for WGSL due to readability of
diagnostics messages, there's no reason this couldn't be used to
simplify other definition files.
Change-Id: I86897d49297c3d4b960e1f73c465103593a445d4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/175242
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/tools/src/tint/intrinsic/resolver/resolver_test.go b/tools/src/tint/intrinsic/resolver/resolver_test.go
index 273a09a..294691a 100644
--- a/tools/src/tint/intrinsic/resolver/resolver_test.go
+++ b/tools/src/tint/intrinsic/resolver/resolver_test.go
@@ -196,6 +196,20 @@
@must_use fn f() -> f32`,
success,
}, {
+ `
+type f32
+type P<T>
+match m: f32
+fn f(m)`,
+ success,
+ }, {
+ `
+type f32
+type P<T>
+match m: f32
+fn f(P<m>)`,
+ success,
+ }, {
`enum E {A A}`,
`
file.txt:1:11 duplicate enum entry 'A'
@@ -524,20 +538,6 @@
`file.txt:4:16 cannot use template enum 'E' as template number`,
}, {
`
-type f32
-type P<T>
-match m: f32
-fn f(m)`,
- `file.txt:4:6 type matcher cannot be used directly here. Use a matcher constrained template argument`,
- }, {
- `
-type f32
-type P<T>
-match m: f32
-fn f(P<m>)`,
- `file.txt:4:8 type matcher cannot be used directly here. Use a matcher constrained template argument`,
- }, {
- `
@must_use fn f()`,
`file.txt:1:2 @must_use can only be used on a function with a return type`,
},