Skip to content

Commit

Permalink
Don't attempt to resolve 'these' on unknwon types
Browse files Browse the repository at this point in the history
Signed-off-by: Danila Fedorin <[email protected]>
  • Loading branch information
DanilaFe committed Nov 20, 2024
1 parent 9385b6b commit 8fb97af
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions frontend/lib/resolution/Resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5069,6 +5069,10 @@ static IterDetails resolveNonZipExpression(Resolver& rv,

auto iterandRe = rv.byPostorder.byAst(iterand);

if (iterandRe.type().isUnknownOrErroneous()) {
// The iterand is unknown, no work to do.
}

// Resolve iterators, stopping immediately when we get a valid yield type.
// We are outside of a zippering contex, so call with only a single IterandComponent.
std::vector<IterandComponent> ics = {
Expand Down Expand Up @@ -5277,6 +5281,10 @@ resolveZipExpression(Resolver& rv, const IndexableLoop* loop, const Zip* zip) {
if (auto leader = (zip->numActuals() ? zip->actual(0) : nullptr)) {
auto leaderQt = rv.byPostorder.byAst(leader).type();

if (leaderQt.isUnknownOrErroneous()) {
return QualifiedType();
}

const auto skippingAllIterands = -1;
int m = IterDetails::NONE;
if (singletonZip) {
Expand Down Expand Up @@ -5309,6 +5317,10 @@ resolveZipExpression(Resolver& rv, const IndexableLoop* loop, const Zip* zip) {
for (int i = 1; i < zip->numActuals(); i++) {
auto follower = zip->actual(i);
ics.emplace_back(rv, follower, follower);

if (ics.back().iterandQt.isUnknownOrErroneous()) {
return QualifiedType();
}
}

auto result = resolveIterDetailsInPriorityOrder(rv, ics, m, &failures);
Expand Down

0 comments on commit 8fb97af

Please sign in to comment.