Skip to content

Commit

Permalink
Warning for "is" used on a superclass
Browse files Browse the repository at this point in the history
  • Loading branch information
aardappel committed Oct 8, 2024
1 parent 60eb237 commit 605df13
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dev/src/lobster/typecheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -3613,6 +3613,8 @@ Node *IsType::TypeCheck(TypeChecker &tc, size_t /*reqret*/) {
resolvedtype = tc.st.ResolveTypeVars(giventype, this->line);
exptype = &tc.st.default_bool_type->thistype;
lt = LT_ANY;
if (resolvedtype->t == V_CLASS && resolvedtype->udt->g.has_subclasses)
tc.Warn(*this, "testing for super class ", Q(resolvedtype->udt->name), " will not work for sub class");
// Check for constness early, to be able to lift out side effects, which
// makes downstream if-then optimisations easier.
Value cval = NilVal();
Expand Down

0 comments on commit 605df13

Please sign in to comment.