Skip to content

Commit

Permalink
Improved "assert will always succeed" with msg with exp
Browse files Browse the repository at this point in the history
  • Loading branch information
aardappel committed Aug 6, 2024
1 parent 20145cf commit dd250a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dev/src/lobster/typecheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -3462,7 +3462,9 @@ Node *NativeCall::TypeCheck(TypeChecker &tc, size_t /*reqret*/) {
tc.CheckFlowTypeChanges(true, children[0]);
Value val;
if (IsRef(argtypes[0]->t) || (children[0]->ConstVal(&tc, val) != V_VOID && val.True())) {
tc.Warn(*this, "assert will always succeed");
string sd;
children[0]->Dump(sd);
tc.Warn(*this, "assert will always succeed: ", sd);
}
// Also make result non-nil, if it was.
if (exptype->t == V_NIL) exptype = exptype->Element();
Expand Down

0 comments on commit dd250a9

Please sign in to comment.