diff --git a/Analysis/src/ConstraintGenerator.cpp b/Analysis/src/ConstraintGenerator.cpp index e242df8ec..9ff03fe43 100644 --- a/Analysis/src/ConstraintGenerator.cpp +++ b/Analysis/src/ConstraintGenerator.cpp @@ -2844,6 +2844,7 @@ Inference ConstraintGenerator::check(const ScopePtr& scope, AstExprTable* expr, ttv->state = TableState::Unsealed; ttv->definitionModuleName = module->name; + ttv->definitionLocation = expr->location; ttv->scope = scope.get(); interiorTypes.back().push_back(ty); @@ -2913,7 +2914,7 @@ Inference ConstraintGenerator::check(const ScopePtr& scope, AstExprTable* expr, std::vector toBlock; if (DFInt::LuauTypeSolverRelease >= 648) { - // This logic is incomplete as we want to re-run this + // This logic is incomplete as we want to re-run this // _after_ blocked types have resolved, but this // allows us to do some bidirectional inference. toBlock = findBlockedTypesIn(expr, NotNull{&module->astTypes}); @@ -2931,7 +2932,7 @@ Inference ConstraintGenerator::check(const ScopePtr& scope, AstExprTable* expr, toBlock ); // The visitor we ran prior should ensure that there are no - // blocked types that we would encounter while matching on + // blocked types that we would encounter while matching on // this expression. LUAU_ASSERT(toBlock.empty()); } @@ -3301,7 +3302,13 @@ TypeId ConstraintGenerator::resolveTableType(const ScopePtr& scope, AstType* ty, ice->ice("Unexpected property access " + std::to_string(int(astIndexer->access))); } - return arena->addType(TableType{props, indexer, scope->level, scope.get(), TableState::Sealed}); + TypeId tableTy = arena->addType(TableType{props, indexer, scope->level, scope.get(), TableState::Sealed}); + TableType* ttv = getMutable(tableTy); + + ttv->definitionModuleName = module->name; + ttv->definitionLocation = tab->location; + + return tableTy; } TypeId ConstraintGenerator::resolveFunctionType( diff --git a/Analysis/src/ConstraintSolver.cpp b/Analysis/src/ConstraintSolver.cpp index 31afabb23..df1e48a30 100644 --- a/Analysis/src/ConstraintSolver.cpp +++ b/Analysis/src/ConstraintSolver.cpp @@ -1111,7 +1111,6 @@ bool ConstraintSolver::tryDispatch(const TypeAliasExpansionConstraint& c, NotNul ttv->instantiatedTypeParams = typeArguments; ttv->instantiatedTypePackParams = packArguments; - // TODO: Fill in definitionModuleName. } bindResult(target); @@ -1337,7 +1336,7 @@ bool ConstraintSolver::tryDispatch(const FunctionCheckConstraint& c, NotNullis() || expr->is() || expr->is() || expr->is()) + else if (expr->is() || expr->is() || expr->is() || + expr->is()) { Unifier2 u2{arena, builtinTypes, constraint->scope, NotNull{&iceReporter}}; u2.unify(actualArgTy, expectedArgTy); @@ -2326,12 +2326,7 @@ bool ConstraintSolver::tryDispatchIterableTable(TypeId iteratorTy, const Iterabl return true; } -bool ConstraintSolver::tryDispatchIterableFunction( - TypeId nextTy, - TypeId tableTy, - const IterableConstraint& c, - NotNull constraint -) +bool ConstraintSolver::tryDispatchIterableFunction(TypeId nextTy, TypeId tableTy, const IterableConstraint& c, NotNull constraint) { const FunctionType* nextFn = get(nextTy); // If this does not hold, we should've never called `tryDispatchIterableFunction` in the first place.