diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-02-12 14:31:56 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-12 14:31:56 -0500 |
| commit | 369279e91dde1b056d8d0e3bb83e7ba3f96321af (patch) | |
| tree | b94af28f1aed8aa57dcb15d039d9dcd739a1534e /tests | |
| parent | cd79bfb5495db14afa167049ccf8e9f4612c5bc2 (diff) | |
Diagnostic location highlighting (#1700)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP: First pass in supporting output of line error information.
* Add support for lexing to better be able to indicate SourceLocation information.
* Fix lexer usage in DiagnosticSink in C++ extractor.
* Update diagnostics tests to have line location info.
* Fixed test expected output that now have source location information in them.
* Better handling of tab.
* Fix test expected results for tabbing change.
* DiagnosticLexer -> DiagnosticSink::SourceLocationLexer
Added line continuation tests.
* Fix typo.
* Added String::appendRepeatedChar
* Change to rerun tests.
Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'tests')
68 files changed, 331 insertions, 38 deletions
diff --git a/tests/bugs/generic-type-arg-overloaded.slang.expected b/tests/bugs/generic-type-arg-overloaded.slang.expected index 518abc2b1..126dcfa60 100644 --- a/tests/bugs/generic-type-arg-overloaded.slang.expected +++ b/tests/bugs/generic-type-arg-overloaded.slang.expected @@ -1,11 +1,17 @@ result code = -1 standard error = { tests/bugs/generic-type-arg-overloaded.slang(14): error 30200: declaration of 'Stuff' conflicts with existing declaration +struct Stuff {} +^~~~~~ tests/bugs/generic-type-arg-overloaded.slang(11): note: see previous declaration of 'Stuff' tests/bugs/generic-type-arg-overloaded.slang(26): error 39999: ambiguous reference to 'Stuff' + return util<Stuff>() + ^~~~~ tests/bugs/generic-type-arg-overloaded.slang(14): note 39999: candidate: Stuff tests/bugs/generic-type-arg-overloaded.slang(11): note 39999: candidate: Stuff tests/bugs/generic-type-arg-overloaded.slang(32): error 39999: expected a generic when using '<...>' (found: '() -> int') + + nonGeneric<G>(); + ^ } standard output = { } diff --git a/tests/bugs/gh-449.slang.expected b/tests/bugs/gh-449.slang.expected index 2bf08bed2..8ca87a406 100644 --- a/tests/bugs/gh-449.slang.expected +++ b/tests/bugs/gh-449.slang.expected @@ -1,7 +1,11 @@ result code = -1 standard error = { tests/bugs/gh-449.slang(18): error 30019: expected an expression of type 'S', got 'vector<float,2>' + foo(a + b); + ^ tests/bugs/gh-449.slang(24): error 30019: expected an expression of type 'S', got 'vector<float,2>' + foo(u + f); + ^ } standard output = { } diff --git a/tests/bugs/gh-463.slang.expected b/tests/bugs/gh-463.slang.expected index d40a845a3..1f03b1907 100644 --- a/tests/bugs/gh-463.slang.expected +++ b/tests/bugs/gh-463.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/bugs/gh-463.slang(7): error 30015: undefined identifier 'COUNT'. +[instance(COUNT)] + ^~~~~ } standard output = { } diff --git a/tests/bugs/gh-75.hlsl.expected b/tests/bugs/gh-75.hlsl.expected index 345acd804..859aa29d9 100644 --- a/tests/bugs/gh-75.hlsl.expected +++ b/tests/bugs/gh-75.hlsl.expected @@ -2,5 +2,7 @@ result code = -1 standard error = { tests/bugs/gh-75.hlsl(24): error 20001: unexpected '}', expected identifier } +^ +} standard output = { } diff --git a/tests/bugs/glsl-layout-define.hlsl.expected b/tests/bugs/glsl-layout-define.hlsl.expected index a151f79e9..e97928b47 100644 --- a/tests/bugs/glsl-layout-define.hlsl.expected +++ b/tests/bugs/glsl-layout-define.hlsl.expected @@ -1,7 +1,11 @@ result code = -1 standard error = { tests/bugs/glsl-layout-define.hlsl(4): error 20001: unexpected identifier, expected integer literal + binding = UNDEFINED_VK_BINDING, + ^~~~~~~~~~~~~~~~~~~~ tests/bugs/glsl-layout-define.hlsl(5): error 20001: unexpected identifier, expected integer literal + set = UNDEFINED_VK_SET) + ^~~~~~~~~~~~~~~~ } standard output = { } diff --git a/tests/bugs/glsl-vk-binding-define.hlsl.expected b/tests/bugs/glsl-vk-binding-define.hlsl.expected index aaac7f0c6..ec90582af 100644 --- a/tests/bugs/glsl-vk-binding-define.hlsl.expected +++ b/tests/bugs/glsl-vk-binding-define.hlsl.expected @@ -1,7 +1,11 @@ result code = -1 standard error = { tests/bugs/glsl-vk-binding-define.hlsl(3): error 30015: undefined identifier 'UNDEFINED_VK_BINDING'. +[[vk::binding(UNDEFINED_VK_BINDING, UNDEFINED_VK_SET)]] + ^~~~~~~~~~~~~~~~~~~~ tests/bugs/glsl-vk-binding-define.hlsl(3): error 30015: undefined identifier 'UNDEFINED_VK_SET'. +[[vk::binding(UNDEFINED_VK_BINDING, UNDEFINED_VK_SET)]] + ^~~~~~~~~~~~~~~~ } standard output = { } diff --git a/tests/bugs/import-with-error.slang.expected b/tests/bugs/import-with-error.slang.expected index 3a70095c3..86f34fc9f 100644 --- a/tests/bugs/import-with-error.slang.expected +++ b/tests/bugs/import-with-error.slang.expected @@ -1,7 +1,11 @@ result code = -1 standard error = { tests/bugs/import-with-error-extra.slang(10): error 30015: undefined identifier 'b'. + int a = b; + ^ tests/bugs/import-with-error.slang(6): fatal error 39999: error in imported module, compilation ceased. +import import_with_error_extra; + ^~~~~~~~~~~~~~~~~~~~~~~ } standard output = { } diff --git a/tests/bugs/keyword-undefined-identifier.slang.expected b/tests/bugs/keyword-undefined-identifier.slang.expected index 00c9fe8db..b7460e23f 100644 --- a/tests/bugs/keyword-undefined-identifier.slang.expected +++ b/tests/bugs/keyword-undefined-identifier.slang.expected @@ -1,7 +1,11 @@ result code = -1 standard error = { tests/bugs/keyword-undefined-identifier.slang(29): error 30015: undefined identifier 'instance'. + return instance; + ^~~~~~~~ tests/bugs/keyword-undefined-identifier.slang(34): error 30015: undefined identifier 'triangle'. + return triangle; + ^~~~~~~~ } standard output = { } diff --git a/tests/bugs/ray-flags-non-constant.slang.expected b/tests/bugs/ray-flags-non-constant.slang.expected index 3c5ef5d07..491682069 100644 --- a/tests/bugs/ray-flags-non-constant.slang.expected +++ b/tests/bugs/ray-flags-non-constant.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/bugs/ray-flags-non-constant.slang(11): error 39999: expression does not evaluate to a compile-time constant + RayQuery<rayFlags> query; + ^~~~~~~~ } standard output = { } diff --git a/tests/diagnostics/accessors.slang.expected b/tests/diagnostics/accessors.slang.expected index a73f31236..b6340d126 100644 --- a/tests/diagnostics/accessors.slang.expected +++ b/tests/diagnostics/accessors.slang.expected @@ -1,8 +1,14 @@ result code = -1 standard error = { tests/diagnostics/accessors.slang(11): error 31101: accessors other than 'set' must not have parameters + get(a) { return 0; } + ^~~ tests/diagnostics/accessors.slang(13): error 31102: a 'set' accessor may not have more than one parameter + set(a, b) { } + ^ tests/diagnostics/accessors.slang(18): error 31102: 'set' parameter 'c' has type 'int' which does not match the expected type 'float' + set(c : int) { } + ^ } standard output = { } diff --git a/tests/diagnostics/attribute-error.slang.expected b/tests/diagnostics/attribute-error.slang.expected index e372eb957..386d08422 100644 --- a/tests/diagnostics/attribute-error.slang.expected +++ b/tests/diagnostics/attribute-error.slang.expected @@ -1,8 +1,14 @@ result code = 1 standard error = { tests/diagnostics/attribute-error.slang(19): error 30019: expected an expression of type 'float', got 'String' +[MyStruct(0, "stringVal")] // attribute arg type mismatch + ^ tests/diagnostics/attribute-error.slang(22): error 31002: attribute 'MyStruct' is not valid here + [MyStruct(0, 10.0)] // attribute does not apply to this construct + ^~~~~~~~ tests/diagnostics/attribute-error.slang(24): error 39999: expression does not evaluate to a compile-time constant + [DefaultValue(2.0)] // attribute arg type mismatch + ^~~ } standard output = { } diff --git a/tests/diagnostics/bad-operator-call.slang.expected b/tests/diagnostics/bad-operator-call.slang.expected index 1aac5cbef..1dd52587c 100644 --- a/tests/diagnostics/bad-operator-call.slang.expected +++ b/tests/diagnostics/bad-operator-call.slang.expected @@ -1,51 +1,63 @@ result code = -1 standard error = { tests/diagnostics/bad-operator-call.slang(18): error 39999: no overload for '+=' applicable to arguments of type (int, S) -core.meta.slang(1762): note 39999: candidate: func +=<T, R:int, C:int>(matrix<T,R,C>, T) -> matrix<T,R,C> -core.meta.slang(1754): note 39999: candidate: func +=<T, R:int, C:int>(matrix<T,R,C>, matrix<T,R,C>) -> matrix<T,R,C> -core.meta.slang(1746): note 39999: candidate: func +=<T, N:int>(vector<T,N>, T) -> vector<T,N> -core.meta.slang(1738): note 39999: candidate: func +=<T, N:int>(vector<T,N>, vector<T,N>) -> vector<T,N> -core.meta.slang(1730): note 39999: candidate: func +=<T>(T, T) -> T + a += b; + ^~ +core.meta.slang(1904): note 39999: candidate: func +=<T, R:int, C:int>(matrix<T,R,C>, T) -> matrix<T,R,C> +core.meta.slang(1896): note 39999: candidate: func +=<T, R:int, C:int>(matrix<T,R,C>, matrix<T,R,C>) -> matrix<T,R,C> +core.meta.slang(1888): note 39999: candidate: func +=<T, N:int>(vector<T,N>, T) -> vector<T,N> +core.meta.slang(1880): note 39999: candidate: func +=<T, N:int>(vector<T,N>, vector<T,N>) -> vector<T,N> +core.meta.slang(1872): note 39999: candidate: func +=<T>(T, T) -> T tests/diagnostics/bad-operator-call.slang(20): error 39999: no overload for '+' applicable to arguments of type (int, S) -core.meta.slang(1652): note 39999: candidate: func +(uint64_t, uint64_t) -> uint64_t -core.meta.slang(1645): note 39999: candidate: func +(uint, uint) -> uint -core.meta.slang(1638): note 39999: candidate: func +(uint16_t, uint16_t) -> uint16_t -core.meta.slang(1631): note 39999: candidate: func +(uint8_t, uint8_t) -> uint8_t -core.meta.slang(1624): note 39999: candidate: func +(double, double) -> double -core.meta.slang(1617): note 39999: candidate: func +(float, float) -> float -core.meta.slang(1610): note 39999: candidate: func +(half, half) -> half -core.meta.slang(1603): note 39999: candidate: func +(int64_t, int64_t) -> int64_t -core.meta.slang(1596): note 39999: candidate: func +(int, int) -> int -core.meta.slang(1589): note 39999: candidate: func +(int16_t, int16_t) -> int16_t + a = a + b; + ^ +core.meta.slang(1710): note 39999: candidate: func +(uint64_t, uint64_t) -> uint64_t +core.meta.slang(1703): note 39999: candidate: func +(uint, uint) -> uint +core.meta.slang(1696): note 39999: candidate: func +(uint16_t, uint16_t) -> uint16_t +core.meta.slang(1689): note 39999: candidate: func +(uint8_t, uint8_t) -> uint8_t +core.meta.slang(1682): note 39999: candidate: func +(double, double) -> double +core.meta.slang(1675): note 39999: candidate: func +(float, float) -> float +core.meta.slang(1668): note 39999: candidate: func +(half, half) -> half +core.meta.slang(1661): note 39999: candidate: func +(int64_t, int64_t) -> int64_t +core.meta.slang(1654): note 39999: candidate: func +(int, int) -> int +core.meta.slang(1647): note 39999: candidate: func +(int16_t, int16_t) -> int16_t tests/diagnostics/bad-operator-call.slang(20): note 39999: 1 more overload candidates tests/diagnostics/bad-operator-call.slang(22): error 39999: no overload for '~' applicable to arguments of type (S) -slang-stdlib.cpp(1644): note 39999: candidate: func ~(uint64_t) -> uint64_t -slang-stdlib.cpp(1641): note 39999: candidate: func ~(uint) -> uint -slang-stdlib.cpp(1638): note 39999: candidate: func ~(uint16_t) -> uint16_t -slang-stdlib.cpp(1635): note 39999: candidate: func ~(uint8_t) -> uint8_t -slang-stdlib.cpp(1632): note 39999: candidate: func ~(int64_t) -> int64_t -slang-stdlib.cpp(1629): note 39999: candidate: func ~(int) -> int -slang-stdlib.cpp(1626): note 39999: candidate: func ~(int16_t) -> int16_t -slang-stdlib.cpp(1623): note 39999: candidate: func ~(int8_t) -> int8_t + a = ~b; + ^ +slang-stdlib.cpp(1718): note 39999: candidate: func ~(uint64_t) -> uint64_t +slang-stdlib.cpp(1715): note 39999: candidate: func ~(uint) -> uint +slang-stdlib.cpp(1712): note 39999: candidate: func ~(uint16_t) -> uint16_t +slang-stdlib.cpp(1709): note 39999: candidate: func ~(uint8_t) -> uint8_t +slang-stdlib.cpp(1706): note 39999: candidate: func ~(int64_t) -> int64_t +slang-stdlib.cpp(1703): note 39999: candidate: func ~(int) -> int +slang-stdlib.cpp(1700): note 39999: candidate: func ~(int16_t) -> int16_t +slang-stdlib.cpp(1697): note 39999: candidate: func ~(int8_t) -> int8_t tests/diagnostics/bad-operator-call.slang(27): error 30047: argument passed to parameter '0' must be l-value. + a += c; + ^ tests/diagnostics/bad-operator-call.slang(27): note 30048: argument was implicitly cast from 'int' to 'vector<int,4>', and Slang does not support using an implicit cast as an l-value tests/diagnostics/bad-operator-call.slang(31): error 39999: no overload for '+=' applicable to arguments of type (vector<float,3>, vector<int,4>) -core.meta.slang(1762): note 39999: candidate: func +=<T, R:int, C:int>(matrix<T,R,C>, T) -> matrix<T,R,C> -core.meta.slang(1754): note 39999: candidate: func +=<T, R:int, C:int>(matrix<T,R,C>, matrix<T,R,C>) -> matrix<T,R,C> -core.meta.slang(1746): note 39999: candidate: func +=<T, N:int>(vector<T,N>, T) -> vector<T,N> -core.meta.slang(1738): note 39999: candidate: func +=<T, N:int>(vector<T,N>, vector<T,N>) -> vector<T,N> -core.meta.slang(1730): note 39999: candidate: func +=<T>(T, T) -> T + d += c; + ^~ +core.meta.slang(1904): note 39999: candidate: func +=<T, R:int, C:int>(matrix<T,R,C>, T) -> matrix<T,R,C> +core.meta.slang(1896): note 39999: candidate: func +=<T, R:int, C:int>(matrix<T,R,C>, matrix<T,R,C>) -> matrix<T,R,C> +core.meta.slang(1888): note 39999: candidate: func +=<T, N:int>(vector<T,N>, T) -> vector<T,N> +core.meta.slang(1880): note 39999: candidate: func +=<T, N:int>(vector<T,N>, vector<T,N>) -> vector<T,N> +core.meta.slang(1872): note 39999: candidate: func +=<T>(T, T) -> T tests/diagnostics/bad-operator-call.slang(33): error 39999: no overload for '+' applicable to arguments of type (vector<int,4>, vector<float,3>) -core.meta.slang(1657): note 39999: candidate: func +<4>(vector<uint64_t,4>, uint64_t) -> vector<uint64_t,4> -core.meta.slang(1655): note 39999: candidate: func +<3>(uint64_t, vector<uint64_t,3>) -> vector<uint64_t,3> -core.meta.slang(1652): note 39999: candidate: func +(uint64_t, uint64_t) -> uint64_t -core.meta.slang(1650): note 39999: candidate: func +<4>(vector<uint,4>, uint) -> vector<uint,4> -core.meta.slang(1648): note 39999: candidate: func +<3>(uint, vector<uint,3>) -> vector<uint,3> -core.meta.slang(1645): note 39999: candidate: func +(uint, uint) -> uint -core.meta.slang(1643): note 39999: candidate: func +<4>(vector<uint16_t,4>, uint16_t) -> vector<uint16_t,4> -core.meta.slang(1641): note 39999: candidate: func +<3>(uint16_t, vector<uint16_t,3>) -> vector<uint16_t,3> -core.meta.slang(1638): note 39999: candidate: func +(uint16_t, uint16_t) -> uint16_t -core.meta.slang(1636): note 39999: candidate: func +<4>(vector<uint8_t,4>, uint8_t) -> vector<uint8_t,4> + d = c + d; + ^ +core.meta.slang(1715): note 39999: candidate: func +<4>(vector<uint64_t,4>, uint64_t) -> vector<uint64_t,4> +core.meta.slang(1713): note 39999: candidate: func +<3>(uint64_t, vector<uint64_t,3>) -> vector<uint64_t,3> +core.meta.slang(1710): note 39999: candidate: func +(uint64_t, uint64_t) -> uint64_t +core.meta.slang(1708): note 39999: candidate: func +<4>(vector<uint,4>, uint) -> vector<uint,4> +core.meta.slang(1706): note 39999: candidate: func +<3>(uint, vector<uint,3>) -> vector<uint,3> +core.meta.slang(1703): note 39999: candidate: func +(uint, uint) -> uint +core.meta.slang(1701): note 39999: candidate: func +<4>(vector<uint16_t,4>, uint16_t) -> vector<uint16_t,4> +core.meta.slang(1699): note 39999: candidate: func +<3>(uint16_t, vector<uint16_t,3>) -> vector<uint16_t,3> +core.meta.slang(1696): note 39999: candidate: func +(uint16_t, uint16_t) -> uint16_t +core.meta.slang(1694): note 39999: candidate: func +<4>(vector<uint8_t,4>, uint8_t) -> vector<uint8_t,4> tests/diagnostics/bad-operator-call.slang(33): note 39999: 23 more overload candidates } standard output = { diff --git a/tests/diagnostics/break-outside-loop.slang.expected b/tests/diagnostics/break-outside-loop.slang.expected index 94af34382..1ed54e981 100644 --- a/tests/diagnostics/break-outside-loop.slang.expected +++ b/tests/diagnostics/break-outside-loop.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/break-outside-loop.slang(6): error 30003: 'break' must appear inside loop constructs. +void foo() { break; } + ^~~~~ } standard output = { } diff --git a/tests/diagnostics/call-argument-type.slang.expected b/tests/diagnostics/call-argument-type.slang.expected index 0854dbbe3..4d30b407a 100644 --- a/tests/diagnostics/call-argument-type.slang.expected +++ b/tests/diagnostics/call-argument-type.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/call-argument-type.slang(10): error 30019: expected an expression of type 'A', got 'B' + f(b); + ^ } standard output = { } diff --git a/tests/diagnostics/call-instance-from-static.slang.expected b/tests/diagnostics/call-instance-from-static.slang.expected index 6be3f7cd5..25f8fda85 100644 --- a/tests/diagnostics/call-instance-from-static.slang.expected +++ b/tests/diagnostics/call-instance-from-static.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/call-instance-from-static.slang(14): error 30100: type 'Test' cannot be used to refer to non-static member 'instanceMethod' + instanceMethod(); + ^~~~~~~~~~~~~~ } standard output = { } diff --git a/tests/diagnostics/constexpr-error.slang.expected b/tests/diagnostics/constexpr-error.slang.expected index c0b5e94d3..4dea62ca1 100644 --- a/tests/diagnostics/constexpr-error.slang.expected +++ b/tests/diagnostics/constexpr-error.slang.expected @@ -1,8 +1,14 @@ result code = -1 standard error = { tests/diagnostics/constexpr-error.slang(27): error 40006: expected a compile-time constant + result += t.Sample(s, uv, offset); + ^~~~~~ tests/diagnostics/constexpr-error.slang(35): error 40006: expected a compile-time constant + result += t.Sample(s, uv, uint2(ii)); + ^ tests/diagnostics/constexpr-error.slang(41): error 40006: expected a compile-time constant + result += t.Sample(s, uv, uint2(jj)); + ^ } standard output = { } diff --git a/tests/diagnostics/continue-outside-loop.slang.expected b/tests/diagnostics/continue-outside-loop.slang.expected index 2298a0ec5..8077baa16 100644 --- a/tests/diagnostics/continue-outside-loop.slang.expected +++ b/tests/diagnostics/continue-outside-loop.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/continue-outside-loop.slang(4): error 30004: 'continue' must appear inside loop constructs. +void foo() { continue; } + ^~~~~~~~ } standard output = { } diff --git a/tests/diagnostics/entry-point-no-stage.slang.expected b/tests/diagnostics/entry-point-no-stage.slang.expected index c63524009..5c941b3ae 100644 --- a/tests/diagnostics/entry-point-no-stage.slang.expected +++ b/tests/diagnostics/entry-point-no-stage.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/entry-point-no-stage.slang(9): error 38007: no stage specified for entry point 'main'; use either a '[shader("name")]' function attribute or the '-stage <name>' command-line option to specify a stage +void main() + ^~~~ } standard output = { } diff --git a/tests/diagnostics/entry-point-stage-mismatch.slang.expected b/tests/diagnostics/entry-point-stage-mismatch.slang.expected index 6a0ebbf96..28aed9307 100644 --- a/tests/diagnostics/entry-point-stage-mismatch.slang.expected +++ b/tests/diagnostics/entry-point-stage-mismatch.slang.expected @@ -1,6 +1,8 @@ result code = 0 standard error = { tests/diagnostics/entry-point-stage-mismatch.slang(9): warning 38006: entry point 'main' being compiled for the 'vertex' stage has a '[shader(...)]' attribute that specifies the 'compute' stage +void main() + ^~~~ } standard output = { } diff --git a/tests/diagnostics/enum-implicit-conversion.slang.expected b/tests/diagnostics/enum-implicit-conversion.slang.expected index 5faca78e6..61164bbaa 100644 --- a/tests/diagnostics/enum-implicit-conversion.slang.expected +++ b/tests/diagnostics/enum-implicit-conversion.slang.expected @@ -1,12 +1,20 @@ result code = -1 standard error = { tests/diagnostics/enum-implicit-conversion.slang(27): error 30019: expected an expression of type 'Color', got 'int' + Color c = val; + ^~~ tests/diagnostics/enum-implicit-conversion.slang(27): note: explicit conversion from 'int' to 'Color' is possible tests/diagnostics/enum-implicit-conversion.slang(34): error 30019: expected an expression of type 'int', got 'Color' + int x = c; + ^ tests/diagnostics/enum-implicit-conversion.slang(34): note: explicit conversion from 'Color' to 'int' is possible tests/diagnostics/enum-implicit-conversion.slang(35): error 30019: expected an expression of type 'uint', got 'Color' + uint y = c; + ^ tests/diagnostics/enum-implicit-conversion.slang(35): note: explicit conversion from 'Color' to 'uint' is possible tests/diagnostics/enum-implicit-conversion.slang(42): error 39999: ambiguous call to 'foo' with arguments of type (Color) + int z = foo(c); + ^ tests/diagnostics/enum-implicit-conversion.slang(18): note 39999: candidate: func foo(uint) -> int tests/diagnostics/enum-implicit-conversion.slang(17): note 39999: candidate: func foo(int) -> int } diff --git a/tests/diagnostics/expected-token.slang.expected b/tests/diagnostics/expected-token.slang.expected index 9c5c886ba..d92dc81ea 100644 --- a/tests/diagnostics/expected-token.slang.expected +++ b/tests/diagnostics/expected-token.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/expected-token.slang(6): error 20001: unexpected ']', expected ';' + int a = 3 ] + ^ } standard output = { } diff --git a/tests/diagnostics/extension-visibility.slang.expected b/tests/diagnostics/extension-visibility.slang.expected index 217dfa188..fb3aaa999 100644 --- a/tests/diagnostics/extension-visibility.slang.expected +++ b/tests/diagnostics/extension-visibility.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/extension-visibility.slang(17): error 39999: could not specialize generic for arguments of type (MyThing) + return helper(thing); + ^ tests/diagnostics/extension-visibility-a.slang(14): note 39999: see declaration of func helper<T>(T) -> int } standard output = { diff --git a/tests/diagnostics/float-literal.slang.expected b/tests/diagnostics/float-literal.slang.expected index 347317666..7e7e45f06 100644 --- a/tests/diagnostics/float-literal.slang.expected +++ b/tests/diagnostics/float-literal.slang.expected @@ -1,9 +1,17 @@ result code = 0 standard error = { tests/diagnostics/float-literal.slang(7): warning 39999: float literal '5e+40' unrepresentable, converted to 'inf' + a += 5e+40; + ^~~~~ tests/diagnostics/float-literal.slang(9): warning 39999: '9e-50' is smaller than the smallest representable value for type float, converted to '0' + a += 9e-50; + ^~~~~ tests/diagnostics/float-literal.slang(19): warning 39999: float literal '5e+40' unrepresentable, converted to 'inf' + b += -5e+40; + ^~~~~ tests/diagnostics/float-literal.slang(20): warning 39999: '9e-50' is smaller than the smallest representable value for type float, converted to '0' + b += -9e-50; + ^~~~~ } standard output = { } diff --git a/tests/diagnostics/gh-1374.slang.expected b/tests/diagnostics/gh-1374.slang.expected index 7f4e0d8f0..f1ae007b5 100644 --- a/tests/diagnostics/gh-1374.slang.expected +++ b/tests/diagnostics/gh-1374.slang.expected @@ -1,8 +1,14 @@ result code = 1 standard error = { tests/diagnostics/gh-1374.slang(9): error 39999: the initial-value expression for variable 'kVal' depends on the value of the variable itself + static const int kVal = kVal; + ^~~~ tests/diagnostics/gh-1374.slang(11): error 39999: the initial-value expression for variable 'kInf' depends on the value of the variable itself + static const int kInf = kInf + 1; + ^~~~ tests/diagnostics/gh-1374.slang(14): error 39999: the initial-value expression for variable 'kB' depends on the value of the variable itself + static const int kB = kA; + ^~ } standard output = { } diff --git a/tests/diagnostics/gh-38-vs.hlsl.expected b/tests/diagnostics/gh-38-vs.hlsl.expected index 1c784e283..bc33e43aa 100644 --- a/tests/diagnostics/gh-38-vs.hlsl.expected +++ b/tests/diagnostics/gh-38-vs.hlsl.expected @@ -1,6 +1,8 @@ result code = 0 standard error = { tests/diagnostics/gh-38-fs.hlsl(5): warning 39001: explicit binding for parameter 'overlappingB' overlaps with parameter 'overlappingA' +Texture2D overlappingB : register(t0); + ^~~~~~~~~~~~ tests/diagnostics/gh-38-vs.hlsl(5): note: see declaration of 'overlappingA' } standard output = { diff --git a/tests/diagnostics/global-uniform.slang.expected b/tests/diagnostics/global-uniform.slang.expected index 6f69ec0c5..44d3599bb 100644 --- a/tests/diagnostics/global-uniform.slang.expected +++ b/tests/diagnostics/global-uniform.slang.expected @@ -1,7 +1,11 @@ result code = 0 standard error = { tests/diagnostics/global-uniform.slang(10): warning 39016: 'b' is implicitly a global shader parameter, not a global variable. If a global variable is intended, add the 'static' modifier. If a uniform shader parameter is intended, add the 'uniform' modifier to silence this warning. +const uint4 b = uint4(0,1,2,3); + ^ tests/diagnostics/global-uniform.slang(13): warning 39016: 'c' is implicitly a global shader parameter, not a global variable. If a global variable is intended, add the 'static' modifier. If a uniform shader parameter is intended, add the 'uniform' modifier to silence this warning. +C c; + ^ } standard output = { } diff --git a/tests/diagnostics/illegal-character.slang.expected b/tests/diagnostics/illegal-character.slang.expected index 4c5ac7086..c2f311643 100644 --- a/tests/diagnostics/illegal-character.slang.expected +++ b/tests/diagnostics/illegal-character.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/illegal-character.slang(4): error 10000: illegal character '`' +` +^ } standard output = { } diff --git a/tests/diagnostics/implicit-cast-lvalue.slang.expected b/tests/diagnostics/implicit-cast-lvalue.slang.expected index e5685fc51..3fdd846a5 100644 --- a/tests/diagnostics/implicit-cast-lvalue.slang.expected +++ b/tests/diagnostics/implicit-cast-lvalue.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/implicit-cast-lvalue.slang(14): error 30047: argument passed to parameter '0' must be l-value. + a(y); + ^ tests/diagnostics/implicit-cast-lvalue.slang(14): note 30048: argument was implicitly cast from 'int' to 'uint', and Slang does not support using an implicit cast as an l-value } standard output = { diff --git a/tests/diagnostics/int-literal.slang.expected b/tests/diagnostics/int-literal.slang.expected index ffc5ff6d2..01e7785f6 100644 --- a/tests/diagnostics/int-literal.slang.expected +++ b/tests/diagnostics/int-literal.slang.expected @@ -1,7 +1,11 @@ result code = 0 standard error = { tests/diagnostics/int-literal.slang(6): warning 39999: integer literal '0x800000000' too large for type 'int' truncated to '0' + int c0 = 0x800000000; + ^~~~~~~~~~~ tests/diagnostics/int-literal.slang(18): warning 39999: integer literal '0xfffffffff' too large for type 'int' truncated to '-1' + int c4 = -0xfffffffff; + ^~~~~~~~~~~ } standard output = { } diff --git a/tests/diagnostics/interface-requirement-not-satisfied.slang.expected b/tests/diagnostics/interface-requirement-not-satisfied.slang.expected index b600a5e21..d7614186b 100644 --- a/tests/diagnostics/interface-requirement-not-satisfied.slang.expected +++ b/tests/diagnostics/interface-requirement-not-satisfied.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/interface-requirement-not-satisfied.slang(10): error 38100: type 'T' does not provide required interface member 'bar' +struct T : IFoo + ^~~~ } standard output = { } diff --git a/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected b/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected index e88b6bd5d..930e71c5b 100644 --- a/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected +++ b/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/interfaces/anyvalue-size-validation.slang(11): error 41011: type 'S' does not fit in the size required by its conforming interface. +struct S : IInterface +^~~~~~ } standard output = { } diff --git a/tests/diagnostics/interfaces/mutating-impl-of-non-mutating-req.slang.expected b/tests/diagnostics/interfaces/mutating-impl-of-non-mutating-req.slang.expected index 922a6c826..3c9ef58d5 100644 --- a/tests/diagnostics/interfaces/mutating-impl-of-non-mutating-req.slang.expected +++ b/tests/diagnostics/interfaces/mutating-impl-of-non-mutating-req.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/interfaces/mutating-impl-of-non-mutating-req.slang(10): error 38100: type 'Counter' does not provide required interface member 'processValue' +struct Counter : IThing + ^~~~~~ } standard output = { } diff --git a/tests/diagnostics/local-used-before-declared.slang.expected b/tests/diagnostics/local-used-before-declared.slang.expected index a248fa969..2317c4a67 100644 --- a/tests/diagnostics/local-used-before-declared.slang.expected +++ b/tests/diagnostics/local-used-before-declared.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/local-used-before-declared.slang(14): fatal error 39999: local variable 'd' is being used before its declaration. + int d = 0; + ^ } standard output = { } diff --git a/tests/diagnostics/local-used-in-own-declaration.slang.expected b/tests/diagnostics/local-used-in-own-declaration.slang.expected index a1421a158..72582e0a9 100644 --- a/tests/diagnostics/local-used-in-own-declaration.slang.expected +++ b/tests/diagnostics/local-used-in-own-declaration.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/local-used-in-own-declaration.slang(12): fatal error 39999: local variable 'e' is being used before its declaration. + int e = e; + ^ } standard output = { } diff --git a/tests/diagnostics/matrix-swizzle.slang.expected b/tests/diagnostics/matrix-swizzle.slang.expected index 8d349a2ed..6c9a14a00 100644 --- a/tests/diagnostics/matrix-swizzle.slang.expected +++ b/tests/diagnostics/matrix-swizzle.slang.expected @@ -1,18 +1,44 @@ result code = -1 standard error = { tests/diagnostics/matrix-swizzle.slang(8): error 30052: invalid swizzle pattern '_14' on type 'int' + int c = m1._14; // Out of bounds + ^ tests/diagnostics/matrix-swizzle.slang(9): error 30052: invalid swizzle pattern '_32' on type 'int' + c = m1._32; + ^ tests/diagnostics/matrix-swizzle.slang(10): error 30052: invalid swizzle pattern '_m22' on type 'int' + c = m2._m22; + ^ tests/diagnostics/matrix-swizzle.slang(11): error 30052: invalid swizzle pattern '_' on type 'int' + c = m2._; // unfinished + ^ tests/diagnostics/matrix-swizzle.slang(12): error 30052: invalid swizzle pattern '_m' on type 'int' + c = m2._m; + ^ tests/diagnostics/matrix-swizzle.slang(13): error 30052: invalid swizzle pattern '_1' on type 'int' + c = m2._1; + ^ tests/diagnostics/matrix-swizzle.slang(14): error 30052: invalid swizzle pattern '_m1' on type 'int' + c = m2._m1; + ^ tests/diagnostics/matrix-swizzle.slang(15): error 30052: invalid swizzle pattern '_m12_' on type 'int' + c = m2._m12_; + ^ tests/diagnostics/matrix-swizzle.slang(16): error 30052: invalid swizzle pattern '_m11_11' on type 'int' + int2 c2 = m1._m11_11; // Mixing of 1 and 0-indexing + ^ tests/diagnostics/matrix-swizzle.slang(17): error 30052: invalid swizzle pattern '_11_11_11_11_11' on type 'int' + c = m1._11_11_11_11_11; // More than 4 elements + ^ tests/diagnostics/matrix-swizzle.slang(18): error 30052: invalid swizzle pattern 'x' on type 'int' + c = m1.x; // Invalid character + ^ tests/diagnostics/matrix-swizzle.slang(19): error 30052: invalid swizzle pattern '_x' on type 'int' + c = m1._x; + ^ tests/diagnostics/matrix-swizzle.slang(20): error 30052: invalid swizzle pattern 'x123' on type 'int' + c = m1.x123; + ^ } standard output = { } diff --git a/tests/diagnostics/methods/mutating-method-on-rvalue.slang.expected b/tests/diagnostics/methods/mutating-method-on-rvalue.slang.expected index 878882bd3..fdf04e6b4 100644 --- a/tests/diagnostics/methods/mutating-method-on-rvalue.slang.expected +++ b/tests/diagnostics/methods/mutating-method-on-rvalue.slang.expected @@ -1,8 +1,12 @@ result code = -1 standard error = { tests/diagnostics/methods/mutating-method-on-rvalue.slang(13): error 30050: mutating method 'increment' cannot be called on an immutable value + increment(); + ^ tests/diagnostics/methods/mutating-method-on-rvalue.slang(13): note 30049: a 'this' parameter is an immutable parameter by default in Slang; apply the `[mutating]` attribute to the function declaration to opt in to a mutable `this` tests/diagnostics/methods/mutating-method-on-rvalue.slang(25): error 30050: mutating method 'increment' cannot be called on an immutable value + gCounter.increment(); + ^ } standard output = { } diff --git a/tests/diagnostics/missing-include-file.slang.expected b/tests/diagnostics/missing-include-file.slang.expected index 7f13d3616..986c8a579 100644 --- a/tests/diagnostics/missing-include-file.slang.expected +++ b/tests/diagnostics/missing-include-file.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/missing-include-file.slang(4): error 15300: failed to find include file 'does-not-exist.h' +#include "does-not-exist.h" + ^~~~~~~~~~~~~~~~~~ } standard output = { } diff --git a/tests/diagnostics/missing-return.slang.expected b/tests/diagnostics/missing-return.slang.expected index d44bfc159..e41e756ff 100644 --- a/tests/diagnostics/missing-return.slang.expected +++ b/tests/diagnostics/missing-return.slang.expected @@ -1,7 +1,11 @@ result code = 0 standard error = { tests/diagnostics/missing-return.slang(7): warning 41010: control flow may reach end of non-'void' function +int bad(int a, int b) + ^~~ tests/diagnostics/missing-return.slang(14): warning 41010: control flow may reach end of non-'void' function +int alsoBad(int a, int b) + ^~~~~~~ } standard output = { } diff --git a/tests/diagnostics/missing-semicolon-after-semantic.slang.expected b/tests/diagnostics/missing-semicolon-after-semantic.slang.expected index ae82385d0..d8baf78c4 100644 --- a/tests/diagnostics/missing-semicolon-after-semantic.slang.expected +++ b/tests/diagnostics/missing-semicolon-after-semantic.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/missing-semicolon-after-semantic.slang(9): error 20001: unexpected '}', expected ';' +}; +^ } standard output = { } diff --git a/tests/diagnostics/overlapping-bindings.slang.expected b/tests/diagnostics/overlapping-bindings.slang.expected index 80481eaf9..bce542b2b 100644 --- a/tests/diagnostics/overlapping-bindings.slang.expected +++ b/tests/diagnostics/overlapping-bindings.slang.expected @@ -1,6 +1,8 @@ result code = 0 standard error = { tests/diagnostics/overlapping-bindings.slang(9): warning 39001: explicit binding for parameter 'b' overlaps with parameter 'a' +Texture2D b : register(t0); + ^ tests/diagnostics/overlapping-bindings.slang(7): note: see declaration of 'a' } standard output = { diff --git a/tests/diagnostics/packoffset.slang.expected b/tests/diagnostics/packoffset.slang.expected index 3930fee6a..701457fe7 100644 --- a/tests/diagnostics/packoffset.slang.expected +++ b/tests/diagnostics/packoffset.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/packoffset.slang(7): error 39012: explicit 'packoffset' bindings are not yet supported in Slang + float4 x : packoffset(c0); + ^~~~~~~~~~ } standard output = { } diff --git a/tests/diagnostics/parameter-already-defined.slang.expected b/tests/diagnostics/parameter-already-defined.slang.expected index b748b9523..fa9ffb581 100644 --- a/tests/diagnostics/parameter-already-defined.slang.expected +++ b/tests/diagnostics/parameter-already-defined.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/parameter-already-defined.slang(4): error 30200: declaration of 'a' conflicts with existing declaration +int foo( int a, float a ) { return 0; } + ^ tests/diagnostics/parameter-already-defined.slang(4): note: see previous declaration of 'a' } standard output = { diff --git a/tests/diagnostics/recursive-import.slang.expected b/tests/diagnostics/recursive-import.slang.expected index 655c328d5..1127b3191 100644 --- a/tests/diagnostics/recursive-import.slang.expected +++ b/tests/diagnostics/recursive-import.slang.expected @@ -1,7 +1,11 @@ result code = -1 standard error = { tests/diagnostics/recursive-import.slang(6): error 38200: module `recursive_import_extra` recursively imports itself +import recursive_import_extra; + ^~~~~~~~~~~~~~~~~~~~~~ tests/diagnostics/recursive-import-extra.slang(6): fatal error 39999: error in imported module, compilation ceased. +import recursive_import; + ^~~~~~~~~~~~~~~~ } standard output = { } diff --git a/tests/diagnostics/register-bindings.slang.expected b/tests/diagnostics/register-bindings.slang.expected index 04d062b10..e71f58b13 100644 --- a/tests/diagnostics/register-bindings.slang.expected +++ b/tests/diagnostics/register-bindings.slang.expected @@ -1,10 +1,20 @@ result code = -1 standard error = { tests/diagnostics/register-bindings.slang(7): error 39007: unknown register class: 'DOESNT_EXIST' +Texture2D a : register(DOESNT_EXIST); + ^~~~~~~~~~~~ tests/diagnostics/register-bindings.slang(10): error 39008: expected a register index after 't' +TextureCube b : register(t); + ^ tests/diagnostics/register-bindings.slang(13): error 39009: expected 'space', got 's' +SamplerState c : register(s0, s1); + ^~ tests/diagnostics/register-bindings.slang(16): error 39010: expected a register space index after 'space' +SamplerState d : register(s2, space); + ^~~~~ tests/diagnostics/register-bindings.slang(19): error 39011: explicit register component masks are not yet supported in Slang +Texture2D e : register(t3.x); + ^ } standard output = { } diff --git a/tests/diagnostics/setter-method.slang.expected b/tests/diagnostics/setter-method.slang.expected index 0c2b5a2c9..1c3dcad48 100644 --- a/tests/diagnostics/setter-method.slang.expected +++ b/tests/diagnostics/setter-method.slang.expected @@ -1,8 +1,12 @@ result code = -1 standard error = { tests/diagnostics/setter-method.slang(16): error 30011: left of '=' is not an l-value. + center = value; + ^ tests/diagnostics/setter-method.slang(16): note 30049: a 'this' parameter is an immutable parameter by default in Slang; apply the `[mutating]` attribute to the function declaration to opt in to a mutable `this` tests/diagnostics/setter-method.slang(21): error 30011: left of '=' is not an l-value. + this.radius = value; + ^ tests/diagnostics/setter-method.slang(21): note 30049: a 'this' parameter is an immutable parameter by default in Slang; apply the `[mutating]` attribute to the function declaration to opt in to a mutable `this` } standard output = { diff --git a/tests/diagnostics/single-target-intrinsic.slang.expected b/tests/diagnostics/single-target-intrinsic.slang.expected index 544cd2d3b..d7662c50e 100644 --- a/tests/diagnostics/single-target-intrinsic.slang.expected +++ b/tests/diagnostics/single-target-intrinsic.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/single-target-intrinsic.slang(13): error 30201: function 'doThing' already has a body +T doThing<T>(T in); + ^~~~~~~ tests/diagnostics/single-target-intrinsic.slang(10): note: see previous definition of 'doThing' } standard output = { diff --git a/tests/diagnostics/static-ref-to-nonstatic-member.slang.expected b/tests/diagnostics/static-ref-to-nonstatic-member.slang.expected index 76550e4b5..dc6629470 100644 --- a/tests/diagnostics/static-ref-to-nonstatic-member.slang.expected +++ b/tests/diagnostics/static-ref-to-nonstatic-member.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/static-ref-to-nonstatic-member.slang(11): error 30100: type 'Color' cannot be used to refer to non-static member 'Red' + int x = Color.Red; + ^ } standard output = { } diff --git a/tests/diagnostics/token-line-continuation.slang b/tests/diagnostics/token-line-continuation.slang new file mode 100644 index 000000000..53f349390 --- /dev/null +++ b/tests/diagnostics/token-line-continuation.slang @@ -0,0 +1,6 @@ +//DIAGNOSTIC_TEST:SIMPLE: + +// Check the diagnostic output if a token uses \ line split + +void foo() { br\ +eak; } diff --git a/tests/diagnostics/token-line-continuation.slang.expected b/tests/diagnostics/token-line-continuation.slang.expected new file mode 100644 index 000000000..754d6b7fc --- /dev/null +++ b/tests/diagnostics/token-line-continuation.slang.expected @@ -0,0 +1,8 @@ +result code = -1 +standard error = { +tests/diagnostics/token-line-continuation.slang(5): error 30003: 'break' must appear inside loop constructs. +void foo() { br\ + ^~ +} +standard output = { +} diff --git a/tests/diagnostics/token-paste-location.slang.expected b/tests/diagnostics/token-paste-location.slang.expected index e8f689a45..987bff15e 100644 --- a/tests/diagnostics/token-paste-location.slang.expected +++ b/tests/diagnostics/token-paste-location.slang.expected @@ -2,6 +2,8 @@ result code = -1 standard error = { token paste(1): error 20001: unexpected '%', expected identifier tests/diagnostics/token-paste-location.slang(10): note: see token pasted location +%% +^ } standard output = { } diff --git a/tests/diagnostics/undefined-identifier.slang.expected b/tests/diagnostics/undefined-identifier.slang.expected index 48361e78c..89454cf46 100644 --- a/tests/diagnostics/undefined-identifier.slang.expected +++ b/tests/diagnostics/undefined-identifier.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/undefined-identifier.slang(6): error 30015: undefined identifier 'b'. + int a = b; + ^ } standard output = { } diff --git a/tests/diagnostics/undefined-in-preprocessor-conditional.slang.expected b/tests/diagnostics/undefined-in-preprocessor-conditional.slang.expected index 76a5d1775..a706bf92f 100644 --- a/tests/diagnostics/undefined-in-preprocessor-conditional.slang.expected +++ b/tests/diagnostics/undefined-in-preprocessor-conditional.slang.expected @@ -1,6 +1,8 @@ result code = 0 standard error = { tests/diagnostics/undefined-in-preprocessor-conditional.slang(8): warning 15205: undefined identifier 'BART' in preprocessor expression will evaluate to zero +#if FOO && BART + ^~~~ } standard output = { } diff --git a/tests/diagnostics/unreachable-code.slang.expected b/tests/diagnostics/unreachable-code.slang.expected index 50a0f812a..6a2f411f6 100644 --- a/tests/diagnostics/unreachable-code.slang.expected +++ b/tests/diagnostics/unreachable-code.slang.expected @@ -1,6 +1,8 @@ result code = 0 standard error = { tests/diagnostics/unreachable-code.slang(10): warning 41000: unreachable code detected + int x = 0; + ^~~ } standard output = { } diff --git a/tests/diagnostics/variable-redeclaration.slang.expected b/tests/diagnostics/variable-redeclaration.slang.expected index d49c4512f..03bed580b 100644 --- a/tests/diagnostics/variable-redeclaration.slang.expected +++ b/tests/diagnostics/variable-redeclaration.slang.expected @@ -1,14 +1,24 @@ result code = -1 standard error = { tests/diagnostics/variable-redeclaration.slang(14): error 30200: declaration of 'gA' conflicts with existing declaration +static Texture2D gA; + ^~ tests/diagnostics/variable-redeclaration.slang(12): note: see previous declaration of 'gA' tests/diagnostics/variable-redeclaration.slang(44): error 30200: declaration of 'f' conflicts with existing declaration + float f; + ^ tests/diagnostics/variable-redeclaration.slang(43): note: see previous declaration of 'f' tests/diagnostics/variable-redeclaration.slang(51): error 30200: declaration of 'size' conflicts with existing declaration + float size) + ^~~~ tests/diagnostics/variable-redeclaration.slang(50): note: see previous declaration of 'size' tests/diagnostics/variable-redeclaration.slang(21): error 30200: declaration of 'y' conflicts with existing declaration + int y = x; + ^ tests/diagnostics/variable-redeclaration.slang(20): note: see previous declaration of 'y' tests/diagnostics/variable-redeclaration.slang(53): error 39999: ambiguous reference to 'size' + return size; + ^~~~ tests/diagnostics/variable-redeclaration.slang(51): note 39999: candidate: size tests/diagnostics/variable-redeclaration.slang(50): note 39999: candidate: size } diff --git a/tests/diagnostics/variable-void-type.slang.expected b/tests/diagnostics/variable-void-type.slang.expected index a243dd50a..3b8735d31 100644 --- a/tests/diagnostics/variable-void-type.slang.expected +++ b/tests/diagnostics/variable-void-type.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/variable-void-type.slang(6): error 30009: invalid type 'void'. + void a; + ^~~~ } standard output = { } diff --git a/tests/diagnostics/vk-bindings.slang.expected b/tests/diagnostics/vk-bindings.slang.expected index 8744787ed..fe37e9340 100644 --- a/tests/diagnostics/vk-bindings.slang.expected +++ b/tests/diagnostics/vk-bindings.slang.expected @@ -1,7 +1,11 @@ result code = -1 standard error = { tests/diagnostics/vk-bindings.slang(6): warning 39013: shader parameter 't' has a 'register' specified for D3D, but no '[[vk::binding(...)]]` specified for Vulkan +Texture2D t : register(t0); + ^~~~~~~~ tests/diagnostics/vk-bindings.slang(14): error 39015: shader parameter 'b' consumes whole descriptor sets, so the binding must be in the form '[[vk::binding(0, ...)]]'; the non-zero binding '2' is not allowed +[[vk::binding(2,1)]] + ^~ } standard output = { } diff --git a/tests/diagnostics/void-function-returning-value.slang.expected b/tests/diagnostics/void-function-returning-value.slang.expected index a94132971..cb1178eca 100644 --- a/tests/diagnostics/void-function-returning-value.slang.expected +++ b/tests/diagnostics/void-function-returning-value.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/void-function-returning-value.slang(16): error 30019: expected an expression of type 'void', got 'int' + return 1; + ^ tests/diagnostics/void-function-returning-value.slang(16): note: explicit conversion from 'int' to 'void' is possible } standard output = { diff --git a/tests/diagnostics/while-predicate-type.slang.expected b/tests/diagnostics/while-predicate-type.slang.expected index c65cb6ef8..34c6de44e 100644 --- a/tests/diagnostics/while-predicate-type.slang.expected +++ b/tests/diagnostics/while-predicate-type.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/diagnostics/while-predicate-type.slang(9): error 30019: expected an expression of type 'bool', got 'S' + while(s) {break;} + ^ } standard output = { } diff --git a/tests/diagnostics/x-macro-line-continuation.slang b/tests/diagnostics/x-macro-line-continuation.slang new file mode 100644 index 000000000..ad8435406 --- /dev/null +++ b/tests/diagnostics/x-macro-line-continuation.slang @@ -0,0 +1,21 @@ +// x-macro-line-continuation.slang +//TEST:SIMPLE: + +// Tests line continuations on diagnostic output of macros + +#define X(M) \ + M(0) \ + M(1) \ + M(2) \ + M(3) \ + M(4, 4) \ + M(5) \ + M(6) \ + M(7) + +#define A(x) + x + x + x + +int sum() +{ + return X(A); +} diff --git a/tests/diagnostics/x-macro-line-continuation.slang.expected b/tests/diagnostics/x-macro-line-continuation.slang.expected new file mode 100644 index 000000000..6b910b701 --- /dev/null +++ b/tests/diagnostics/x-macro-line-continuation.slang.expected @@ -0,0 +1,8 @@ +result code = -1 +standard error = { +tests/diagnostics/x-macro-line-continuation.slang(12): error 15501: wrong number of arguments to macro (expected 1, got 2) + M(5) \ + ^ +} +standard output = { +} diff --git a/tests/preprocessor/define-function-like.slang.expected b/tests/preprocessor/define-function-like.slang.expected index aed62dc31..1e4b4dcc9 100644 --- a/tests/preprocessor/define-function-like.slang.expected +++ b/tests/preprocessor/define-function-like.slang.expected @@ -1,7 +1,11 @@ result code = -1 standard error = { tests/preprocessor/define-function-like.slang(16): error 30015: undefined identifier 'x'. +#define M (x) - (x) + ^ tests/preprocessor/define-function-like.slang(16): error 30015: undefined identifier 'x'. +#define M (x) - (x) + ^ } standard output = { } diff --git a/tests/preprocessor/define-redefine.slang.expected b/tests/preprocessor/define-redefine.slang.expected index 2542c05d8..9b376bfe8 100644 --- a/tests/preprocessor/define-redefine.slang.expected +++ b/tests/preprocessor/define-redefine.slang.expected @@ -1,6 +1,8 @@ result code = 0 standard error = { tests/preprocessor/define-redefine.slang(10): warning 15400: redefinition of macro 'FOO' +#define FOO 2.0f + ^~~ tests/preprocessor/define-redefine.slang(6): note: see previous definition of 'FOO' } standard output = { diff --git a/tests/preprocessor/error.slang.expected b/tests/preprocessor/error.slang.expected index 56742c5d5..927819780 100644 --- a/tests/preprocessor/error.slang.expected +++ b/tests/preprocessor/error.slang.expected @@ -1,6 +1,8 @@ result code = -1 standard error = { tests/preprocessor/error.slang(11): error 15900: #error: This isn't valid! +#error This isn't valid! + ^~~~~ } standard output = { } diff --git a/tests/preprocessor/include-multiple.slang.expected b/tests/preprocessor/include-multiple.slang.expected index d52a5a2ab..f254ecf2f 100644 --- a/tests/preprocessor/include-multiple.slang.expected +++ b/tests/preprocessor/include-multiple.slang.expected @@ -1,8 +1,12 @@ result code = -1 standard error = { tests/preprocessor/include-a.slang.h(3): error 30201: function 'bar' already has a body +int bar() { return foo(); } + ^~~ tests/preprocessor/include-a.slang.h(3): note: see previous definition of 'bar' tests/preprocessor/include-a.slang.h(3): error 30201: function 'bar' already has a body +int bar() { return foo(); } + ^~~ tests/preprocessor/include-a.slang.h(3): note: see previous definition of 'bar' } standard output = { diff --git a/tests/preprocessor/line.slang.expected b/tests/preprocessor/line.slang.expected index 8c7f72ada..bea5b2a70 100644 --- a/tests/preprocessor/line.slang.expected +++ b/tests/preprocessor/line.slang.expected @@ -1,11 +1,23 @@ result code = -1 standard error = { tests/preprocessor/line.slang(4): error 30015: undefined identifier 'FooA'. +FooA a() { return 0; } +^~~~ b.slang(99): error 30015: undefined identifier 'FooB'. +FooB b() { return 0; } +^~~~ tests/preprocessor/line.slang(10): error 30015: undefined identifier 'FooC'. +FooC c() { return 0; } +^~~~ d.slang(603): error 30015: undefined identifier 'FooD'. +FooD d() { return 0; } +^~~~ d.slang(40): error 30015: undefined identifier 'FooE'. +FooE e() { return 0; } +^~~~ tests/preprocessor/line.slang(19): error 30015: undefined identifier 'FooF'. +FooF f() { return 0; } +^~~~ } standard output = { } diff --git a/tests/preprocessor/output-includes.slang.expected b/tests/preprocessor/output-includes.slang.expected index 791621aa3..84f0a4411 100644 --- a/tests/preprocessor/output-includes.slang.expected +++ b/tests/preprocessor/output-includes.slang.expected @@ -7,8 +7,12 @@ standard error = { (0): note: include 'tests/preprocessor/include-a.slang.h' (0): note: include 'tests/preprocessor/include-a.slang.h' tests/preprocessor/include-a.slang.h(3): error 30201: function 'bar' already has a body +int bar() { return foo(); } + ^~~ tests/preprocessor/include-a.slang.h(3): note: see previous definition of 'bar' tests/preprocessor/include-a.slang.h(3): error 30201: function 'bar' already has a body +int bar() { return foo(); } + ^~~ tests/preprocessor/include-a.slang.h(3): note: see previous definition of 'bar' } standard output = { diff --git a/tests/preprocessor/undef.slang.expected b/tests/preprocessor/undef.slang.expected index 2f7026487..8ea240124 100644 --- a/tests/preprocessor/undef.slang.expected +++ b/tests/preprocessor/undef.slang.expected @@ -1,6 +1,8 @@ result code = 0 standard error = { tests/preprocessor/undef.slang(5): warning 15401: macro 'FOO' is not defined +#undef FOO + ^~~ } standard output = { } diff --git a/tests/preprocessor/warning.slang.expected b/tests/preprocessor/warning.slang.expected index 0c765e31b..66b1e5f17 100644 --- a/tests/preprocessor/warning.slang.expected +++ b/tests/preprocessor/warning.slang.expected @@ -1,6 +1,8 @@ result code = 0 standard error = { tests/preprocessor/warning.slang(9): warning 15901: #warning: You wouldn't like me when I'm angry... +#warning You wouldn't like me when I'm angry... + ^~~~~~~ } standard output = { } |
