From a17b68a0ecc4c8e91d2ba3685f6e5bc30e3ead8c Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 5 Feb 2019 13:41:04 -0800 Subject: Produce a better error message on errors in inheritance clauses (#828) If I write: ``` struct Foo : IDoesntExist {} ``` Then currently Slang complains first that `IDoesntExist` is an undefined identifier, then it complains that it expected an interface type in the inheritance clause. The second ("cascading") error isn't really helpful, because of *course* if something isn't defined it isn't an interface. This change detects the case where the type expression is erroneous so that we avoid the cascading error. --- source/slang/check.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/slang/check.cpp b/source/slang/check.cpp index cc245b5f4..921ef61e6 100644 --- a/source/slang/check.cpp +++ b/source/slang/check.cpp @@ -2310,6 +2310,11 @@ namespace Slang return; } } + else if(base.type.is()) + { + // If an error was already produced, don't emit a cascading error. + return; + } // If type expression didn't name an interface, we'll emit an error here // TODO: deal with the case of an error in the type expression (don't cascade) -- cgit v1.2.3