From 369279e91dde1b056d8d0e3bb83e7ba3f96321af Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 12 Feb 2021 14:31:56 -0500 Subject: 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 --- tests/bugs/generic-type-arg-overloaded.slang.expected | 6 ++++++ tests/bugs/gh-449.slang.expected | 4 ++++ tests/bugs/gh-463.slang.expected | 2 ++ tests/bugs/gh-75.hlsl.expected | 2 ++ tests/bugs/glsl-layout-define.hlsl.expected | 4 ++++ tests/bugs/glsl-vk-binding-define.hlsl.expected | 4 ++++ tests/bugs/import-with-error.slang.expected | 4 ++++ tests/bugs/keyword-undefined-identifier.slang.expected | 4 ++++ tests/bugs/ray-flags-non-constant.slang.expected | 2 ++ 9 files changed, 32 insertions(+) (limited to 'tests/bugs') 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() + ^~~~~ 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(); + ^ } 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' + foo(a + b); + ^ tests/bugs/gh-449.slang(24): error 30019: expected an expression of type 'S', got 'vector' + 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 query; + ^~~~~~~~ } standard output = { } -- cgit v1.2.3