skia2/tests/sksl/errors/ArrayOfInvalidSize.glsl
John Stiles aa369d2b8e Fix error with inlined literals overflowing their types.
It's possible to write code containing errors that are only apparent
once the inliner runs. For instance, a function which takes a short and
returns its negative it is valid for most inputs, but undefined for
-32768 (because +32768 does not fit in a short). A function which takes
floats and casts them to ints is valid for many inputs, but not valid if
you pass in 5 billion.

This CL restructures our out-of-range integer error detection to report
errors cleanly in these cases instead of asserting. It also refactors
the range checking code to be usable in situations where we don't yet
have a Literal expression.

Change-Id: I98f0be63bf9afbbf1ab90233fa86d380cfae42b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466439
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-02 14:26:44 +00:00

25 lines
932 B
GLSL

### Compilation failed:
error: 1: array size must be positive
error: 2: array size must be positive
error: 3: array size must be positive
error: 4: expected 'int', but found 'float'
error: 5: integer is out of range for type 'int': 4000000000
error: 5: array size must be an integer
error: 6: expected 'int', but found 'bool'
error: 7: expected 'int', but found 'bool'
error: 8: expected 'int', but found 'int2'
error: 9: missing index in '[]'
error: 10: integer is out of range for type 'int': 4000000000
error: 12: array size must be positive
error: 13: array size must be positive
error: 14: array size must be positive
error: 15: array size must be an integer
error: 16: array size out of bounds
error: 17: array size must be an integer
error: 18: array size must be an integer
error: 19: array size must be an integer
error: 20: expected array dimension
error: 21: integer is out of range for type 'int': 4000000000
21 errors