Skip to content

Commit

Permalink
Merge pull request #345 from PlutoLang/missing-arg-coverage
Browse files Browse the repository at this point in the history
Raise a warning if non-nilable argument is not provided by caller
  • Loading branch information
Sainan authored Aug 25, 2023
2 parents 17c845c + 274eee4 commit dec8db7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ struct TypeHint {
}

[[nodiscard]] bool isCompatibleWith(const TypeHint& b) const noexcept {
if (b.empty()) {
return isNullable();
}
for (const auto& desc : b.descs) {
if (!isCompatibleWith(desc)) {
return false;
Expand Down Expand Up @@ -265,6 +268,9 @@ struct TypeHint {
}

[[nodiscard]] std::string toString() const {
if (empty()) {
return "nil";
}
std::string str{};
if (isNullable())
str.push_back('?');
Expand Down

0 comments on commit dec8db7

Please sign in to comment.