Skip to content

Commit

Permalink
Make index wait for pending indexerTy
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-police committed Sep 13, 2024
1 parent a8047b2 commit e831ad2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Analysis/src/TypeFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2206,6 +2206,19 @@ TypeFunctionReductionResult<TypeId> indexFunctionImpl(
return {std::nullopt, true, {}, {}};

TypeId indexerTy = follow(typeParams.at(1));

// Whether the type is still pending.
//
// TODO: A generalized sanity check function for all type functions?
// But it should be optional for customization
// for functions that specifically need type function
// This here fixes a stack overflow.
// https://github.com/luau-lang/luau/issues/1406
if (isPending(indexerTy, ctx->solver))
{
return {std::nullopt, false, {indexerTy}, {}};
}

std::shared_ptr<const NormalizedType> indexerNormTy = ctx->normalizer->normalize(indexerTy);

// if the indexer failed to normalize, we can't reduce, but know nothing about inhabitance.
Expand Down

0 comments on commit e831ad2

Please sign in to comment.