2022-09-16 06:38:17 +08:00
|
|
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
#pragma once
|
|
|
|
|
2023-11-04 07:45:04 +08:00
|
|
|
#include "Luau/ConstraintGenerator.h"
|
2022-10-22 01:54:01 +08:00
|
|
|
#include "Luau/ConstraintSolver.h"
|
2022-09-16 06:38:17 +08:00
|
|
|
#include "Luau/DcrLogger.h"
|
2024-11-09 05:41:45 +08:00
|
|
|
#include "Luau/EqSatSimplification.h"
|
2022-09-16 06:38:17 +08:00
|
|
|
#include "Luau/Module.h"
|
2024-11-09 05:41:45 +08:00
|
|
|
#include "Luau/TypeArena.h"
|
2022-09-16 06:38:17 +08:00
|
|
|
|
|
|
|
#include "Fixture.h"
|
|
|
|
#include "ScopedFlags.h"
|
|
|
|
|
|
|
|
namespace Luau
|
|
|
|
{
|
|
|
|
|
2023-11-04 07:45:04 +08:00
|
|
|
struct ConstraintGeneratorFixture : Fixture
|
2022-09-16 06:38:17 +08:00
|
|
|
{
|
|
|
|
TypeArena arena;
|
|
|
|
ModulePtr mainModule;
|
|
|
|
DcrLogger logger;
|
2022-10-22 01:54:01 +08:00
|
|
|
UnifierSharedState sharedState{&ice};
|
2023-01-05 04:53:17 +08:00
|
|
|
Normalizer normalizer{&arena, builtinTypes, NotNull{&sharedState}};
|
2024-11-09 05:41:45 +08:00
|
|
|
SimplifierPtr simplifier;
|
2024-10-05 02:29:55 +08:00
|
|
|
TypeCheckLimits limits;
|
|
|
|
TypeFunctionRuntime typeFunctionRuntime{NotNull{&ice}, NotNull{&limits}};
|
2022-10-22 01:54:01 +08:00
|
|
|
|
|
|
|
std::unique_ptr<DataFlowGraph> dfg;
|
2023-11-04 07:45:04 +08:00
|
|
|
std::unique_ptr<ConstraintGenerator> cg;
|
2022-10-22 01:54:01 +08:00
|
|
|
Scope* rootScope = nullptr;
|
|
|
|
|
|
|
|
std::vector<NotNull<Constraint>> constraints;
|
2022-09-16 06:38:17 +08:00
|
|
|
|
|
|
|
ScopedFastFlag forceTheFlag;
|
|
|
|
|
2023-11-04 07:45:04 +08:00
|
|
|
ConstraintGeneratorFixture();
|
2022-10-22 01:54:01 +08:00
|
|
|
|
|
|
|
void generateConstraints(const std::string& code);
|
|
|
|
void solve(const std::string& code);
|
2022-09-16 06:38:17 +08:00
|
|
|
};
|
|
|
|
|
2022-10-15 03:48:41 +08:00
|
|
|
} // namespace Luau
|