luau/tests/ConstraintGeneratorFixture.h
Vighnesh-V e190754565
Sync to upstream/release/680 (#1894)
# What's Changed?

This week includes many changes to bring the behaviours of the Old and
New Luau Type Solver more in line.
* The old solver now stringifies tables identically to the new solver.
Sealed tables are stringified as `{ ... }` and unsealed tables are
represented by `{| ... |}`, regardless of your choice of solver.


## New Type Solver

* Miscellaneous fixes to make the Luau Frontend able to dynamically
toggle which solve is used.
* Small fixes to reduce instances of nondeterminism of the New Type
Solver.
* Issue an error when a function that has multiple non-viable overloads
is used.
* Subtyping now returns more information about the generics for type
inference to consume.
* Stop stuck type-functions from blocking type inference. This should
lead to fewer instances of 'type inference failed to complete'.

## Fragment Autocomplete
* Fixed a bug where incremental autocomplete wouldn't be able to provide
results directly on a required module script.
`require(script.Module).{request completions here}` will now recommend
the properties returned by the required object.

---
Co-authored-by: Andy Friesen <afriesen@roblox.com>
Co-authored-by: Hunter Goldstein <hgoldstein@roblox.com>
Co-authored-by: Sora Kanosue <skanosue@roblox.com>
Co-authored-by: Talha Pathan <tpathan@roblox.com>
Co-authored-by: Vighnesh Vijay <vvijay@roblox.com>
2025-06-27 13:14:36 -07:00

42 lines
1.1 KiB
C++

// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
#pragma once
#include "Luau/ConstraintGenerator.h"
#include "Luau/ConstraintSolver.h"
#include "Luau/DcrLogger.h"
#include "Luau/EqSatSimplification.h"
#include "Luau/Module.h"
#include "Luau/TypeArena.h"
#include "Fixture.h"
#include "ScopedFlags.h"
namespace Luau
{
struct ConstraintGeneratorFixture : Fixture
{
TypeArena arena;
ModulePtr mainModule;
DcrLogger logger;
UnifierSharedState sharedState{&ice};
Normalizer normalizer{&arena, getBuiltins(), NotNull{&sharedState}, SolverMode::New};
SimplifierPtr simplifier;
TypeCheckLimits limits;
TypeFunctionRuntime typeFunctionRuntime{NotNull{&ice}, NotNull{&limits}};
std::unique_ptr<DataFlowGraph> dfg;
std::unique_ptr<ConstraintGenerator> cg;
Scope* rootScope = nullptr;
std::vector<NotNull<Constraint>> constraints;
ScopedFastFlag forceTheFlag;
ConstraintGeneratorFixture();
void generateConstraints(const std::string& code);
void solve(const std::string& code);
};
} // namespace Luau