Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions tslang/lib/TypeScript/MLIRGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2577,15 +2577,19 @@ class MLIRGenImpl

if (callOpsCount <= paramIndex)
{
// there is no more ops
// there is no more ops; mark processed so the param is counted once -
// recounting it every round inflated totalProcessed past the termination
// equality below and spun the loop into the "loop detected" guard
if (paramInfo->getIsOptional() || isa<mlir_ts::OptionalType>(paramType))
{
paramInfo->processed = true;
processed++;
continue;
}

if (paramInfo->getIsMultiArgsParam())
{
paramInfo->processed = true;
processed++;
continue;
}
Expand Down Expand Up @@ -2640,8 +2644,11 @@ class MLIRGenImpl

if (processed == 0)
{
emitError(location) << "not all types could be inferred";
return mlir::failure();
// no progress in a full round: some params (e.g. a callback typed by a
// type param that only gets its value from a default) can't be inferred
// here; the default zipping and the completeness check below decide
// whether that is an error
break;
}

totalProcessed += processed;
Expand All @@ -2653,7 +2660,7 @@ class MLIRGenImpl

if (totalProcessed > funcOp->getParams().size() + 100)
{
// TODO: find out the issue
// defensive only: with params counted exactly once this is unreachable
emitError(location) << "loop detected.";
return mlir::failure();
}
Expand Down
Loading