Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/Analysis/include/Luau/ConstraintSet.h
2727 views
1
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2
3
#pragma once
4
5
#include "Luau/Constraint.h"
6
#include "Luau/TypeIds.h"
7
#include "Luau/Error.h"
8
9
#include <vector>
10
11
namespace Luau
12
{
13
14
struct ConstraintSet
15
{
16
NotNull<Scope> rootScope;
17
18
std::vector<ConstraintPtr> constraints;
19
20
// The set of all free types created during constraint generation
21
TypeIds freeTypes;
22
23
// Map a function's signature scope back to its signature type. Once we've
24
// dispatched all of the constraints pertaining to a particular free type,
25
// we use this mapping to generalize that free type.
26
DenseHashMap<Scope*, TypeId> scopeToFunction{nullptr};
27
28
// It is pretty uncommon for constraint generation to itself produce errors, but it can happen.
29
std::vector<TypeError> errors;
30
};
31
32
} // namespace Luau
33
34