summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2019-02-05 13:41:04 -0800
committerGitHub <noreply@github.com>2019-02-05 13:41:04 -0800
commita17b68a0ecc4c8e91d2ba3685f6e5bc30e3ead8c (patch)
treedac9810693ba5f56ae852544e76c79bd92841d0b
parent9b80537bc0272a9caf93f146d8964d9bdd4a407e (diff)
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.
-rw-r--r--source/slang/check.cpp5
1 files changed, 5 insertions, 0 deletions
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<ErrorType>())
+ {
+ // 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)