[naga] Make additional test code reachable from entrypoints

This commit is contained in:
Andy Leiserson 2025-05-15 16:43:47 -07:00 committed by Jim Blandy
parent 25636e274b
commit 0997b99429
3 changed files with 9 additions and 2 deletions

View File

@ -35,5 +35,6 @@ void main() {
const vec4 from_input_array = in_array[1];
const float a = array_2d[0][0];
const float b = array_toomanyd[0][0][0][0][0][0][0];
const LightScatteringParams light_scattering_params;
out_array[0] = vec4(2.0);
}

View File

@ -2861,7 +2861,12 @@ fn compaction_preserves_spans() {
var x: array<i32,1>;
var y = x[1.0];
}
"#; // ^^^ correct error span: 108..114
@compute @workgroup_size(1)
fn main() {
f();
}
"#;
// The error span should be on `x[1.0]`, which is at characters 108..114.
let mut module = naga::front::wgsl::parse_str(source).expect("source ought to parse");
naga::compact::compact(&mut module);
let err = naga::valid::Validator::new(
@ -2878,7 +2883,7 @@ fn compaction_preserves_spans() {
// The first span is the whole function.
let _ = spans.next().expect("error should have at least one span");
// The second span is the assignment destination.
// The second span is the invalid indexing expression.
let dest_span = spans
.next()
.expect("error should have at least two spans")

View File

@ -43,6 +43,7 @@ fn main_1() {
var from_input_array: vec4<f32>;
var a_1: f32;
var b: f32;
var light_scattering_params: LightScatteringParams;
let _e17 = in_array_2[1];
from_input_array = _e17;