Skip to content

Commit 0997b99

Browse files
andyleisersonjimblandy
authored andcommitted
[naga] Make additional test code reachable from entrypoints
1 parent 25636e2 commit 0997b99

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

naga/tests/in/glsl/declarations.frag

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ void main() {
3535
const vec4 from_input_array = in_array[1];
3636
const float a = array_2d[0][0];
3737
const float b = array_toomanyd[0][0][0][0][0][0][0];
38+
const LightScatteringParams light_scattering_params;
3839
out_array[0] = vec4(2.0);
3940
}

naga/tests/naga/wgsl_errors.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,7 +2861,12 @@ fn compaction_preserves_spans() {
28612861
var x: array<i32,1>;
28622862
var y = x[1.0];
28632863
}
2864-
"#; // ^^^ correct error span: 108..114
2864+
@compute @workgroup_size(1)
2865+
fn main() {
2866+
f();
2867+
}
2868+
"#;
2869+
// The error span should be on `x[1.0]`, which is at characters 108..114.
28652870
let mut module = naga::front::wgsl::parse_str(source).expect("source ought to parse");
28662871
naga::compact::compact(&mut module);
28672872
let err = naga::valid::Validator::new(
@@ -2878,7 +2883,7 @@ fn compaction_preserves_spans() {
28782883
// The first span is the whole function.
28792884
let _ = spans.next().expect("error should have at least one span");
28802885

2881-
// The second span is the assignment destination.
2886+
// The second span is the invalid indexing expression.
28822887
let dest_span = spans
28832888
.next()
28842889
.expect("error should have at least two spans")

naga/tests/out/wgsl/glsl-declarations.frag.wgsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ fn main_1() {
4343
var from_input_array: vec4<f32>;
4444
var a_1: f32;
4545
var b: f32;
46+
var light_scattering_params: LightScatteringParams;
4647

4748
let _e17 = in_array_2[1];
4849
from_input_array = _e17;

0 commit comments

Comments
 (0)