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 | |
| 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>
79 files changed, 605 insertions, 59 deletions
diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp index 4b1ec4c84..a7374d8ba 100644 --- a/source/core/slang-string.cpp +++ b/source/core/slang-string.cpp @@ -362,6 +362,18 @@ namespace Slang } } + void String::appendRepeatedChar(char chr, Index count) + { + SLANG_ASSERT(count >= 0); + if (count > 0) + { + char* chars = prepareForAppend(count); + // Set all space to repeated chr. + ::memset(chars, chr, sizeof(char) * count); + appendInPlace(chars, count); + } + } + void String::appendChar(char c) { const auto oldLength = getLength(); diff --git a/source/core/slang-string.h b/source/core/slang-string.h index e57718d40..3fb184ac7 100644 --- a/source/core/slang-string.h +++ b/source/core/slang-string.h @@ -100,6 +100,10 @@ namespace Slang { return slice.m_begin >= m_begin && slice.m_end <= m_end; } + bool isMemoryContained(const char* pos) const + { + return pos >= m_begin && pos <= m_end; + } Index getLength() const { @@ -439,6 +443,9 @@ namespace Slang /// Append a character (to remove ambiguity with other integral types) void appendChar(char chr); + /// Append the specified char count times + void appendRepeatedChar(char chr, Index count); + String(const char* str) { append(str); diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index 8c11e538d..a1c8369aa 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -1888,7 +1888,7 @@ namespace Slang // a temporary one. // DiagnosticSink* savedSink = m_shared->m_sink; - DiagnosticSink tempSink(savedSink->getSourceManager()); + DiagnosticSink tempSink(savedSink->getSourceManager(), nullptr); m_shared->m_sink = &tempSink; // With our temporary diagnostic sink soaking up any messages @@ -2177,7 +2177,7 @@ namespace Slang // of diagnostics more easily. // DiagnosticSink* savedSink = m_shared->m_sink; - DiagnosticSink tempSink(savedSink->getSourceManager()); + DiagnosticSink tempSink(savedSink->getSourceManager(), nullptr); m_shared->m_sink = &tempSink; // We start by constructing an expression that represents diff --git a/source/slang/slang-diagnostics.cpp b/source/slang/slang-diagnostics.cpp index 04ada6fc4..4b450c9a9 100644 --- a/source/slang/slang-diagnostics.cpp +++ b/source/slang/slang-diagnostics.cpp @@ -6,6 +6,7 @@ #include "../core/slang-memory-arena.h" #include "../core/slang-dictionary.h" #include "../core/slang-string-util.h" +#include "../core/slang-char-util.h" #include "../core/slang-name-convention-util.h" #include <assert.h> @@ -160,6 +161,160 @@ static void formatDiagnostic(const HumaneSourceLoc& humaneLoc, Diagnostic const& outBuilder << "\n"; } +static void _replaceTabWithSpaces(const UnownedStringSlice& slice, Int tabSize, StringBuilder& out) +{ + const char* start = slice.begin(); + const char*const end = slice.end(); + + const Index startLength = out.getLength(); + + for (const char* cur = start; cur < end; cur++) + { + if (*cur == '\t') + { + if (start < cur) + { + out.append(start, cur); + } + + // The amount of spaces we add depends on the current position. + const Index lastPosition = out.getLength() - startLength; + Index tabPosition = lastPosition; + + // Strip the tabPosition so it's back to the tab stop + // Special case if tabSize is a power of 2 + if ((tabSize & (tabSize - 1)) == 0) + { + tabPosition = tabPosition & ~Index(tabSize - 1); + } + else + { + tabPosition -= tabPosition % tabSize; + } + + // Move to next tab + tabPosition += tabSize; + + // The amount of spaces to simulate the tab + const Index spacesCount = tabPosition - lastPosition; + + // Add the spaces + out.appendRepeatedChar(' ', spacesCount); + + // Set the start at the first character past + start = cur + 1; + } + } + + if (start < end) + { + out.append(start, end); + } +} + +// Given multi-line text, and a position within the text (as a pointer into the memory of text) +// extract the line that contains pos +static UnownedStringSlice _extractLineContainingPosition(const UnownedStringSlice& text, const char* pos) +{ + SLANG_ASSERT(text.isMemoryContained(pos)); + + const char*const contentStart = text.begin(); + const char*const contentEnd = text.end(); + + // We want to determine the start of the line, and the end of the line + const char* start = pos; + for (; start > contentStart; --start) + { + const char c = *start; + if (c == '\n' || c == '\r') + { + // We want the character after, but we can only do this if not already at pos + start += int(start < pos); + break; + } + } + const char* end = pos; + for (; end < contentEnd; ++end) + { + const char c = *end; + if (c == '\n' || c == '\r') + { + break; + } + } + + return UnownedStringSlice(start, end); +} + +static void _sourceLocationNoteDiagnostic(SourceView* sourceView, SourceLoc sourceLoc, DiagnosticSink::SourceLocationLexer lexer, StringBuilder& sb) +{ + SourceFile* sourceFile = sourceView->getSourceFile(); + if (!sourceFile) + { + return; + } + + UnownedStringSlice content = sourceFile->getContent(); + + // Make sure the offset is within content. + // This is important because it's possible to have a 'SourceFile' that doesn't contain any content + // (for example when reconstructed via serialization with just line offsets, the actual source text 'content' isn't available). + const int offset = sourceView->getRange().getOffset(sourceLoc); + if (offset < 0 || offset >= content.getLength()) + { + return; + } + + // Work out the position of the SourceLoc in the source + const char*const pos = content.begin() + offset; + + UnownedStringSlice line = _extractLineContainingPosition(content, pos); + + // Trim any trailing white space + line = UnownedStringSlice(line.begin(), line.trim().end()); + + // TODO(JS): The tab size should ideally be configurable from command line. + // For now just go with 4. + const Index tabSize = 4; + + StringBuilder sourceLine; + StringBuilder caretLine; + + // First work out the sourceLine + _replaceTabWithSpaces(line, tabSize, sourceLine); + + // Now the caretLine which appears underneath the sourceLine + { + // Produce the text up to the caret position (at pos), taking into account tabs + _replaceTabWithSpaces(UnownedStringSlice(line.begin(), pos), tabSize, caretLine); + + // Now make all spaces + const Index length = caretLine.getLength(); + caretLine.Clear(); + caretLine.appendRepeatedChar(' ', length); + + // Add caret + caretLine << "^"; + + if (lexer) + { + UnownedStringSlice token = lexer(UnownedStringSlice(pos, line.end())); + + if (token.getLength() > 1) + { + caretLine.appendRepeatedChar('~', token.getLength() - 1); + } + } + } + + // We could have handling here for if the line is too long, that we surround the important section + // will ellipsis for example. + // For now we just output. + + sb << sourceLine << "\n"; + sb << caretLine << "\n"; +} + static void formatDiagnostic( DiagnosticSink* sink, Diagnostic const& diagnostic, @@ -214,7 +369,14 @@ static void formatDiagnostic( } } } - + + // We don't don't output source line information if this is a 'note' as a note is extra information for one + // of the other main severity types, and so the information should already be output on the initial line + if (sourceView && sink->isFlagSet(DiagnosticSink::Flag::SourceLocationLine) && diagnostic.severity != Severity::Note) + { + _sourceLocationNoteDiagnostic(sourceView, sourceLoc, sink->getSourceLocationLexer(), sb); + } + if (sourceView && sink->isFlagSet(DiagnosticSink::Flag::VerbosePath)) { auto actualHumaneLoc = sourceView->getHumaneLoc(diagnostic.loc, SourceLocType::Actual); diff --git a/source/slang/slang-diagnostics.h b/source/slang/slang-diagnostics.h index deec57b7c..05080989a 100644 --- a/source/slang/slang-diagnostics.h +++ b/source/slang/slang-diagnostics.h @@ -131,6 +131,7 @@ namespace Slang {} }; + class DiagnosticSink { public: @@ -140,10 +141,15 @@ namespace Slang { enum Enum: Flags { - VerbosePath = 0x1, ///< Will display a more verbose path (if available) - such as a canonical or absolute path + VerbosePath = 0x1, ///< Will display a more verbose path (if available) - such as a canonical or absolute path + SourceLocationLine = 0x2, ///< If set will display the location line if source is available }; }; + /// Used by diagnostic sink to be able to underline tokens. If not defined on the DiagnosticSink, + /// will only display a caret at the SourceLoc + typedef UnownedStringSlice(*SourceLocationLexer)(const UnownedStringSlice& text); + /// Get the total amount of errors that have taken place on this DiagnosticSink SLANG_FORCE_INLINE int getErrorCount() { return m_errorCount; } @@ -209,10 +215,22 @@ namespace Slang /// Test if flag is set bool isFlagSet(Flag::Enum flag) { return (m_flags & Flags(flag)) != 0; } + /// Get the (optional) diagnostic sink lexer. This is used to + /// improve quality of highlighting a locations token. If not set, will just have a single + /// character caret at location + SourceLocationLexer getSourceLocationLexer() const { return m_sourceLocationLexer; } + /// Ctor - DiagnosticSink(SourceManager* sourceManager) - : m_sourceManager(sourceManager) - {} + DiagnosticSink(SourceManager* sourceManager, SourceLocationLexer sourceLocationLexer) + : m_sourceManager(sourceManager), + m_sourceLocationLexer(sourceLocationLexer) + { + // If we have a source location lexer, we'll by default enable source location output + if (sourceLocationLexer) + { + setFlag(Flag::SourceLocationLine); + } + } // Public members @@ -231,6 +249,8 @@ namespace Slang // The source manager to use when mapping source locations to file+line info SourceManager* m_sourceManager = nullptr; + + SourceLocationLexer m_sourceLocationLexer; }; /// An `ISlangWriter` that writes directly to a diagnostic sink. diff --git a/source/slang/slang-lexer.cpp b/source/slang/slang-lexer.cpp index fe268223d..b0146c5b0 100644 --- a/source/slang/slang-lexer.cpp +++ b/source/slang/slang-lexer.cpp @@ -1339,4 +1339,40 @@ namespace Slang return tokenList; } } + + /* static */UnownedStringSlice Lexer::sourceLocationLexer(const UnownedStringSlice& in) + { + Lexer lexer; + + SourceManager sourceManager; + sourceManager.initialize(nullptr, nullptr); + + auto sourceFile = sourceManager.createSourceFileWithString(PathInfo::makeUnknown(), in); + auto sourceView = sourceManager.createSourceView(sourceFile, nullptr, SourceLoc::fromRaw(0)); + + DiagnosticSink sink(&sourceManager, nullptr); + + MemoryArena arena; + + RootNamePool rootNamePool; + NamePool namePool; + namePool.setRootNamePool(&rootNamePool); + + lexer.initialize(sourceView, &sink, &namePool, &arena); + + Token tok = lexer.lexToken(); + + if (tok.type == TokenType::Invalid) + { + return UnownedStringSlice(); + } + + const int offset = sourceView->getRange().getOffset(tok.loc); + + SLANG_ASSERT(offset >= 0 && offset <= in.getLength()); + SLANG_ASSERT(Index(offset + tok.charsCount) <= in.getLength()); + + return UnownedStringSlice(in.begin() + offset, in.begin() + offset + tok.charsCount); + } + } diff --git a/source/slang/slang-lexer.h b/source/slang/slang-lexer.h index d404296ff..957d05fec 100644 --- a/source/slang/slang-lexer.h +++ b/source/slang/slang-lexer.h @@ -106,6 +106,16 @@ namespace Slang ~Lexer(); + /// Runs the lexer to try and extract a single token, which is returned. + /// This can be used by the DiagnosticSink to be able to display more appropriate + /// information when displaying a source location - such as underscoring the + /// token at that location. + /// + /// NOTE! This function is relatively slow, and is designed for use around this specific + /// purpose. It does not return a token or a token type, because that information is + /// not needed by the DiagnosticSink. + static UnownedStringSlice sourceLocationLexer(const UnownedStringSlice& in); + Token lexToken(LexerFlags extraFlags = 0); TokenList lexAllTokens(); @@ -128,6 +138,7 @@ namespace Slang MemoryArena* m_memoryArena; }; + // Helper routines for extracting values from tokens String getStringLiteralTokenValue(Token const& token); String getFileNameTokenValue(Token const& token); diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp index b15d215da..8ea51645a 100644 --- a/source/slang/slang-parser.cpp +++ b/source/slang/slang-parser.cpp @@ -1762,7 +1762,11 @@ namespace Slang TokenSpan tokenSpan; tokenSpan.m_begin = parser->tokenReader.m_cursor; tokenSpan.m_end = parser->tokenReader.m_end; - DiagnosticSink newSink(parser->sink->getSourceManager()); + + // Setup without diagnostic lexer, or SourceLocationLine output + // as this sink is just to *try* generic application + DiagnosticSink newSink(parser->sink->getSourceManager(), nullptr); + Parser newParser(*parser); newParser.sink = &newSink; diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp index 2a3667295..dcfed07b0 100644 --- a/source/slang/slang-reflection-api.cpp +++ b/source/slang/slang-reflection-api.cpp @@ -718,7 +718,8 @@ SLANG_API SlangReflectionType * spReflection_FindTypeByName(SlangReflection * re // when type lookup fails. // Slang::DiagnosticSink sink( - programLayout->getTargetReq()->getLinkage()->getSourceManager()); + programLayout->getTargetReq()->getLinkage()->getSourceManager(), + Lexer::sourceLocationLexer); try { @@ -2560,7 +2561,7 @@ SLANG_API SlangReflectionType* spReflection_specializeType( auto linkage = programLayout->getProgram()->getLinkage(); - DiagnosticSink sink(linkage->getSourceManager()); + DiagnosticSink sink(linkage->getSourceManager(), Lexer::sourceLocationLexer); auto specializedType = linkage->specializeType(unspecializedType, specializationArgCount, (Type* const*) specializationArgs, &sink); diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index b711a5327..14f30c632 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -773,7 +773,7 @@ SLANG_NO_THROW slang::IModule* SLANG_MCALL Linkage::loadModule( { auto name = getNamePool()->getName(moduleName); - DiagnosticSink sink(getSourceManager()); + DiagnosticSink sink(getSourceManager(), Lexer::sourceLocationLexer); auto module = findOrImportModule(name, SourceLoc(), &sink); sink.getBlobIfNeeded(outDiagnostics); @@ -797,7 +797,7 @@ SLANG_NO_THROW SlangResult SLANG_MCALL Linkage::createCompositeComponentType( return SLANG_OK; } - DiagnosticSink sink(getSourceManager()); + DiagnosticSink sink(getSourceManager(), Lexer::sourceLocationLexer); List<RefPtr<ComponentType>> childComponents; for( Int cc = 0; cc < componentTypeCount; ++cc ) @@ -834,7 +834,7 @@ SLANG_NO_THROW slang::TypeReflection* SLANG_MCALL Linkage::specializeType( typeArgs.add(asInternal(arg.type)); } - DiagnosticSink sink(getSourceManager()); + DiagnosticSink sink(getSourceManager(), Lexer::sourceLocationLexer); auto specializedType = specializeType(unspecializedType, typeArgs.getCount(), typeArgs.getBuffer(), &sink); sink.getBlobIfNeeded(outDiagnostics); @@ -1185,7 +1185,7 @@ Expr* Linkage::parseTermString(String typeStr, RefPtr<Scope> scope) Slang::SourceFile* srcFile = localSourceManager.createSourceFileWithString(PathInfo::makeTypeParse(), typeStr); // We'll use a temporary diagnostic sink - DiagnosticSink sink(&localSourceManager); + DiagnosticSink sink(&localSourceManager, nullptr); // RAII type to make make sure current SourceManager is restored after parse. // Use RAII - to make sure everything is reset even if an exception is thrown. @@ -1845,7 +1845,7 @@ BackEndCompileRequest::BackEndCompileRequest( EndToEndCompileRequest::EndToEndCompileRequest( Session* session) : m_session(session) - , m_sink(nullptr) + , m_sink(nullptr, Lexer::sourceLocationLexer) { RefPtr<ASTBuilder> astBuilder(new ASTBuilder(session->m_sharedASTBuilder, "EndToEnd::Linkage::astBuilder")); m_linkage = new Linkage(session, astBuilder, session->getBuiltinLinkage()); @@ -1856,7 +1856,7 @@ EndToEndCompileRequest::EndToEndCompileRequest( Linkage* linkage) : m_session(linkage->getSessionImpl()) , m_linkage(linkage) - , m_sink(nullptr) + , m_sink(nullptr, Lexer::sourceLocationLexer) { init(); } @@ -2627,7 +2627,7 @@ SLANG_NO_THROW slang::ProgramLayout* SLANG_MCALL ComponentType::getLayout( return nullptr; auto target = linkage->targets[targetIndex]; - DiagnosticSink sink(linkage->getSourceManager()); + DiagnosticSink sink(linkage->getSourceManager(), Lexer::sourceLocationLexer); auto programLayout = getTargetProgram(target)->getOrCreateLayout(&sink); sink.getBlobIfNeeded(outDiagnostics); @@ -2647,7 +2647,7 @@ SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::getEntryPointCode( auto targetProgram = getTargetProgram(target); - DiagnosticSink sink(linkage->getSourceManager()); + DiagnosticSink sink(linkage->getSourceManager(), Lexer::sourceLocationLexer); auto& entryPointResult = targetProgram->getOrCreateEntryPointResult(entryPointIndex, &sink); sink.getBlobIfNeeded(outDiagnostics); @@ -2698,7 +2698,7 @@ SLANG_NO_THROW SlangResult SLANG_MCALL ComponentType::specialize( slang::IComponentType** outSpecializedComponentType, ISlangBlob** outDiagnostics) { - DiagnosticSink sink(getLinkage()->getSourceManager()); + DiagnosticSink sink(getLinkage()->getSourceManager(), Lexer::sourceLocationLexer); // First let's check if the number of arguments given matches // the number of parameters that are present on this component type. @@ -3575,7 +3575,7 @@ void Session::addBuiltinSource( { SourceManager* sourceManager = getBuiltinSourceManager(); - DiagnosticSink sink(sourceManager); + DiagnosticSink sink(sourceManager, Lexer::sourceLocationLexer); RefPtr<FrontEndCompileRequest> compileRequest = new FrontEndCompileRequest( m_builtinLinkage, &sink); 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 = { } diff --git a/tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp b/tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp index 84c803b7c..a2fd4cb25 100644 --- a/tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp +++ b/tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp @@ -2706,7 +2706,7 @@ int main(int argc, const char*const* argv) SourceManager sourceManager; sourceManager.initialize(nullptr, nullptr); - DiagnosticSink sink(&sourceManager); + DiagnosticSink sink(&sourceManager, Lexer::sourceLocationLexer); sink.writer = writer; CPPExtractorApp app(&sink, &sourceManager, &rootNamePool); |
