Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync to upstream/release/596 #1050

Merged
merged 177 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
c6ac06e
Sync to upstream/release/543
zeux Sep 1, 2022
75b8a2a
Merge branch 'upstream' into merge
zeux Sep 1, 2022
dec4b67
Sync to upstream/release/544
zeux Sep 8, 2022
ff18a63
Merge branch 'master' into merge
zeux Sep 8, 2022
71df988
Merge branch 'upstream' into merge
zeux Sep 8, 2022
6c70897
Patch the test for now to work with 16K pages
zeux Sep 8, 2022
dd710f6
Sync to upstream/release/545
zeux Sep 15, 2022
19ac72a
Merge branch 'master' into merge
zeux Sep 15, 2022
6e957a4
Merge branch 'upstream' into merge
zeux Sep 15, 2022
48fb5a3
Sync to upstream/release/546
zeux Sep 23, 2022
cd66ad6
Merge branch 'master' into merge
zeux Sep 23, 2022
7bea908
Merge branch 'upstream' into merge
zeux Sep 23, 2022
4176e1c
Fix internals library
zeux Sep 23, 2022
d0989b9
Sync to upstream/release/547
zeux Sep 29, 2022
123649d
Merge branch 'master' into merge
zeux Sep 29, 2022
ebf252f
Merge branch 'upstream' into merge
zeux Sep 29, 2022
91e144a
Sync to upstream/release/548
zeux Oct 6, 2022
9bfe2b8
Merge branch 'master' into merge
zeux Oct 6, 2022
4a79c7f
Merge branch 'upstream' into merge
zeux Oct 6, 2022
d82e736
Sync to upstream/release/549
vegorov-rbx Oct 13, 2022
6aafd2b
Merge branch 'master' into merge
vegorov-rbx Oct 13, 2022
1dca05d
Merge branch 'upstream' into merge
vegorov-rbx Oct 13, 2022
48fd16d
Fix build error
vegorov-rbx Oct 14, 2022
6a98d15
Responding to PR comments
vegorov-rbx Oct 14, 2022
2eff6cf
Sync to upstream/release/550
andyfriesen Oct 21, 2022
72fdf6f
Merge branch 'master' into merge
andyfriesen Oct 21, 2022
b9451c6
Merge branch 'upstream' into merge
andyfriesen Oct 21, 2022
99c0db3
Sync to upstream/release/551
vegorov-rbx Oct 27, 2022
dbedb3c
Merge remote-tracking branch 'upstream/master' into merge
vegorov-rbx Oct 27, 2022
b4b125c
Merge branch 'upstream' into merge
vegorov-rbx Oct 27, 2022
a6cbb0f
Fix clang-14 / GNU ld interaction for target_clones
zeux Oct 28, 2022
e3fdab3
Sync to upstream/release/552
andyfriesen Nov 4, 2022
d189305
Merge branch 'master' into merge
andyfriesen Nov 4, 2022
8fd7d22
Merge branch 'upstream' into merge
andyfriesen Nov 4, 2022
3155ba0
Sync to upstream/release/553
vegorov-rbx Nov 10, 2022
3289fc1
Merge remote-tracking branch 'upstream/master' into merge
vegorov-rbx Nov 10, 2022
2b36613
Merge branch 'upstream' into merge
vegorov-rbx Nov 10, 2022
f521695
Sync to upstream/release/554
andyfriesen Nov 18, 2022
d5ff348
Merge remote-tracking branch 'origin/master' into merge
andyfriesen Nov 18, 2022
3ac3798
Merge branch 'upstream' into merge
andyfriesen Nov 18, 2022
fc45969
Sync to upstream/release/555
vegorov-rbx Dec 2, 2022
471ec75
Merge branch 'master' into merge
vegorov-rbx Dec 2, 2022
621d21d
Merge branch 'upstream' into merge
vegorov-rbx Dec 2, 2022
f10b294
What even is this
vegorov-rbx Dec 2, 2022
6cd507d
Work-around for gcc
vegorov-rbx Dec 2, 2022
abe6768
Sync to upstream/release/556
andyfriesen Dec 9, 2022
4ba102f
Merge branch 'master' into merge
andyfriesen Dec 9, 2022
1197bcd
Merge branch 'upstream' into merge
andyfriesen Dec 9, 2022
9958d23
Sync to upstream/release/557
vegorov-rbx Jan 3, 2023
11e129f
Merge branch 'master' into merge
vegorov-rbx Jan 3, 2023
c48b4d7
Merge branch 'upstream' into merge
vegorov-rbx Jan 3, 2023
ee364a3
Fixed iterator invalidation issue
vegorov-rbx Jan 3, 2023
1958676
Re-using uncleared normalizer in unsafe
vegorov-rbx Jan 4, 2023
36f5009
Sync to upstream/release/558
vegorov-rbx Jan 6, 2023
5e3fbc4
Merge branch 'master' into merge
vegorov-rbx Jan 6, 2023
cf45ce6
Merge branch 'upstream' into merge
vegorov-rbx Jan 6, 2023
5db9675
Smaller recursion limit to not hit stack overflow in debug on Windows
vegorov-rbx Jan 6, 2023
a2365f2
Fix build warning
vegorov-rbx Jan 6, 2023
96c1caf
Sync to upstream/release/559
andyfriesen Jan 13, 2023
b1000a6
Merge branch 'master' into merge
andyfriesen Jan 13, 2023
efaf15e
Merge branch 'upstream' into merge
andyfriesen Jan 13, 2023
eec289a
Sync to upstream/release/560
vegorov-rbx Jan 20, 2023
652f319
Merge branch 'master' into merge
vegorov-rbx Jan 20, 2023
7a43ae3
Merge branch 'upstream' into merge
vegorov-rbx Jan 20, 2023
b0b7dfb
Fix a few style changes that went out-of-sync
vegorov-rbx Jan 20, 2023
53d03f9
Sync to upstream/release/561
andyfriesen Jan 27, 2023
7c5dd3c
Merge branch 'master' into merge
andyfriesen Jan 27, 2023
a17481b
Merge branch 'upstream' into merge
andyfriesen Jan 27, 2023
b7af49c
Fix signed/unsigned comparison warnings on GCC.
andyfriesen Jan 27, 2023
523db5e
Another GCC fix.
andyfriesen Jan 27, 2023
dba2936
Sync to upstream/release/562
vegorov-rbx Feb 3, 2023
f49f073
Merge branch 'master' into merge
vegorov-rbx Feb 3, 2023
c76dd1c
Merge branch 'upstream' into merge
vegorov-rbx Feb 3, 2023
b388e27
Sync to upstream/release/563
andyfriesen Feb 10, 2023
41ff9cb
Merge branch 'master' into merge
andyfriesen Feb 10, 2023
c3b1945
Merge branch 'upstream' into merge
andyfriesen Feb 10, 2023
5c77305
Sync to upstream/release/564
vegorov-rbx Feb 17, 2023
1f8ec89
Merge branch 'master' into merge
vegorov-rbx Feb 17, 2023
be06c31
Merge branch 'upstream' into merge
vegorov-rbx Feb 17, 2023
1e7b23f
Sync to upstream/release/565
andyfriesen Feb 24, 2023
3974fcc
Merge branch 'master' into merge
andyfriesen Feb 24, 2023
7a822c9
Merge branch 'upstream' into merge
andyfriesen Feb 24, 2023
e58bb1b
GCC fix.
andyfriesen Feb 24, 2023
9a281f0
Sync to upstream/release/566
vegorov-rbx Mar 3, 2023
ca34b44
Merge branch 'master' into merge
vegorov-rbx Mar 3, 2023
ac9718e
Merge branch 'upstream' into merge
vegorov-rbx Mar 3, 2023
4653484
Sync to upstream/release/567
andyfriesen Mar 10, 2023
cfee765
Merge branch 'master' into merge
andyfriesen Mar 10, 2023
a0fe195
Merge branch 'upstream' into merge
andyfriesen Mar 10, 2023
e280064
Sync to upstream/release/568
vegorov-rbx Mar 17, 2023
bbeec10
Merge branch 'master' into merge
vegorov-rbx Mar 17, 2023
1c4d7a6
Merge branch 'upstream' into merge
vegorov-rbx Mar 17, 2023
81200e1
Sync to upstream/release/569
andyfriesen Mar 24, 2023
ce18822
Merge branch 'master' into merge
andyfriesen Mar 24, 2023
c955451
Merge branch 'upstream' into merge
andyfriesen Mar 24, 2023
d1acde3
Sync to upstream/release/570
vegorov-rbx Mar 31, 2023
c6b6ab6
Merge branch 'master' into merge
vegorov-rbx Mar 31, 2023
d70df63
Merge branch 'upstream' into merge
vegorov-rbx Mar 31, 2023
d071e41
g++ build fix
vegorov-rbx Mar 31, 2023
5309401
Sync to upstream/release/571
andyfriesen Apr 7, 2023
97f8bf6
Merge branch 'master' into merge
andyfriesen Apr 7, 2023
395bf5c
Merge branch 'upstream' into merge
andyfriesen Apr 7, 2023
5e771b8
Sync to upstream/release/572
vegorov-rbx Apr 14, 2023
70ef0fb
Merge branch 'master' into merge
vegorov-rbx Apr 14, 2023
1ffbf6c
Merge branch 'upstream' into merge
vegorov-rbx Apr 14, 2023
33b9558
Build fix
vegorov-rbx Apr 14, 2023
d5cdb68
Sync to upstream/release/573
andyfriesen Apr 21, 2023
a0f9842
Merge branch 'master' into merge
andyfriesen Apr 21, 2023
1126490
Merge branch 'upstream' into merge
andyfriesen Apr 21, 2023
1c2ce0d
Sync to upstream/release/574
vegorov-rbx Apr 28, 2023
8bd3714
Merge branch 'master' into merge
vegorov-rbx Apr 28, 2023
348f85c
Merge branch 'upstream' into merge
vegorov-rbx Apr 28, 2023
716f633
Sync to upstream/release/575
andyfriesen May 5, 2023
cc96f86
Merge branch 'master' into merge
andyfriesen May 5, 2023
95f0a04
Merge branch 'upstream' into merge
andyfriesen May 5, 2023
12c1edf
This test fails on a64 so disable it for now.
andyfriesen May 5, 2023
f7c7801
Add pthread as a link dependency to Luau.Analyze.CLI for Linux.
andyfriesen May 5, 2023
3247aab
Sync to upstream/release/576
vegorov-rbx May 12, 2023
38ab2e5
Merge branch 'master' into merge
vegorov-rbx May 12, 2023
59c2698
Merge branch 'upstream' into merge
vegorov-rbx May 12, 2023
eb71060
Sync to upstream/release/577
andyfriesen May 19, 2023
4fb7594
Merge branch 'master' into merge
andyfriesen May 19, 2023
f3a6e37
Merge branch 'upstream' into merge
andyfriesen May 19, 2023
123496b
gcc fix.
andyfriesen May 19, 2023
b8e9d07
Sync to upstream/release/578
vegorov-rbx May 25, 2023
f97a897
Merge branch 'master' into merge
vegorov-rbx May 25, 2023
fc9557d
Merge branch 'upstream' into merge
vegorov-rbx May 25, 2023
f435740
Sync to upstream/release/579
andyfriesen Jun 2, 2023
349d6f4
Merge branch 'master' into merge
andyfriesen Jun 2, 2023
a3d22de
Merge branch 'upstream' into merge
andyfriesen Jun 2, 2023
88cd3dd
Sync to upstream/release/580
vegorov-rbx Jun 9, 2023
ef2e46e
Merge branch 'master' into merge
vegorov-rbx Jun 9, 2023
a9becc9
Merge branch 'upstream' into merge
vegorov-rbx Jun 9, 2023
212888c
Fix build warning
vegorov-rbx Jun 9, 2023
6ee4f19
Sync to upstream/release/581
andyfriesen Jun 16, 2023
f9cfef1
Merge branch 'master' into merge
andyfriesen Jun 16, 2023
00b9898
Merge branch 'upstream' into merge
andyfriesen Jun 16, 2023
8bc2f51
Sync to upstream/release/582
vegorov-rbx Jun 24, 2023
7a2f94a
Merge branch 'master' into merge
vegorov-rbx Jun 24, 2023
e1a7c3b
Merge branch 'upstream' into merge
vegorov-rbx Jun 24, 2023
e00dbbe
Sync to upstream/release/583
andyfriesen Jul 7, 2023
01cbf18
Merge branch 'master' into merge
andyfriesen Jul 7, 2023
b92d4d7
Merge branch 'upstream' into merge
andyfriesen Jul 7, 2023
dc2a1cc
GCC fix.
andyfriesen Jul 7, 2023
b403075
Sync to upstream/release/584
vegorov-rbx Jul 14, 2023
03063d0
Merge branch 'master' into merge
vegorov-rbx Jul 14, 2023
4ffa98f
Merge branch 'upstream' into merge
vegorov-rbx Jul 14, 2023
f16d002
GCC fix
vegorov-rbx Jul 14, 2023
5e1aca1
Sync to upstream/release/588
vegorov-rbx Jul 28, 2023
9fd79ad
Merge branch 'master' into merge
vegorov-rbx Jul 28, 2023
4c6a370
Merge branch 'upstream' into merge
vegorov-rbx Jul 28, 2023
25cc75b
* Progress toward a diffing algorithm for types. We hope that this w…
andyfriesen Aug 4, 2023
e25b717
Merge branch 'master' into merge
andyfriesen Aug 4, 2023
b26eeac
Merge branch 'upstream' into merge
andyfriesen Aug 4, 2023
63d9e3e
Smaller recursion limit for NoOpt in the failing test
vegorov-rbx Aug 4, 2023
089da9e
Sync to upstream/release/590
vegorov-rbx Aug 11, 2023
d841a32
Merge branch 'master' into merge
vegorov-rbx Aug 11, 2023
50571a7
Merge branch 'upstream' into merge
vegorov-rbx Aug 11, 2023
433d966
Sync to upstream/release/591
andyfriesen Aug 18, 2023
434e618
Merge branch 'master' into merge
andyfriesen Aug 18, 2023
bdc2f69
Merge branch 'upstream' into merge
andyfriesen Aug 18, 2023
a811050
Sync to upstream/release/592
vegorov-rbx Aug 25, 2023
263c282
Merge branch 'master' into merge
vegorov-rbx Aug 25, 2023
8cf1343
Merge branch 'upstream' into merge
vegorov-rbx Aug 25, 2023
51d4d18
Late fixes
vegorov-rbx Aug 25, 2023
397dbb1
Sync to upstream/release/593
AmaranthineCodices Sep 1, 2023
a2df595
Merge branch 'master' into merge
AmaranthineCodices Sep 1, 2023
09fdb4c
Merge branch 'upstream' into merge
AmaranthineCodices Sep 1, 2023
8e28c24
Sync to upstream/release/594
vegorov-rbx Sep 7, 2023
5143f5e
Merge branch 'master' into merge
vegorov-rbx Sep 7, 2023
789ece0
Merge branch 'upstream' into merge
vegorov-rbx Sep 7, 2023
d8b97f4
Sync to upstream/release/595
andyfriesen Sep 15, 2023
55d7a99
Merge branch 'master' into merge
andyfriesen Sep 15, 2023
c044932
Merge branch 'upstream' into merge
andyfriesen Sep 15, 2023
81681e2
Sync to upstream/release/596
aatxe Sep 22, 2023
d4de6f7
Merge branch 'master' into merge
aatxe Sep 22, 2023
3882ab1
Merge branch 'upstream' into merge
aatxe Sep 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Analysis/include/Luau/ConstraintSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ struct ConstraintSolver
* the result.
* @param subType the sub-type to unify.
* @param superType the super-type to unify.
* @returns optionally a unification too complex error if unification failed
*/
ErrorVec unify(NotNull<Scope> scope, Location location, TypeId subType, TypeId superType);
std::optional<TypeError> unify(NotNull<Scope> scope, Location location, TypeId subType, TypeId superType);

/**
* Creates a new Unifier and performs a single unification operation. Commits
Expand Down Expand Up @@ -233,6 +234,15 @@ struct ConstraintSolver
void reportError(TypeErrorData&& data, const Location& location);
void reportError(TypeError e);

/**
* Checks the existing set of constraints to see if there exist any that contain
* the provided free type, indicating that it is not yet ready to be replaced by
* one of its bounds.
* @param ty the free type that to check for related constraints
* @returns whether or not it is unsafe to replace the free type by one of its bounds
*/
bool hasUnresolvedConstraints(TypeId ty);

private:

/** Helper used by tryDispatch(SubtypeConstraint) and
Expand Down
2 changes: 2 additions & 0 deletions Analysis/include/Luau/Subtyping.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ struct Subtyping
SubtypingResult isCovariantWith(const PrimitiveType* subPrim, const TableType* superTable);
SubtypingResult isCovariantWith(const SingletonType* subSingleton, const TableType* superTable);

SubtypingResult isCovariantWith(const TableIndexer& subIndexer, const TableIndexer& superIndexer);

SubtypingResult isCovariantWith(const NormalizedType* subNorm, const NormalizedType* superNorm);
SubtypingResult isCovariantWith(const NormalizedClassType& subClass, const NormalizedClassType& superClass);
SubtypingResult isCovariantWith(const NormalizedClassType& subClass, const TypeIds& superTables);
Expand Down
2 changes: 0 additions & 2 deletions Analysis/include/Luau/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ struct BlockedType
{
BlockedType();
int index;

static int DEPRECATED_nextIndex;
};

struct PrimitiveType
Expand Down
52 changes: 42 additions & 10 deletions Analysis/include/Luau/TypeFamily.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct TypeFamily

/// The reducer function for the type family.
std::function<TypeFamilyReductionResult<TypeId>(std::vector<TypeId>, std::vector<TypePackId>, NotNull<TypeArena>, NotNull<BuiltinTypes>,
NotNull<TxnLog>, NotNull<Scope>, NotNull<Normalizer>)>
NotNull<TxnLog>, NotNull<Scope>, NotNull<Normalizer>, ConstraintSolver*)>
reducer;
};

Expand All @@ -68,7 +68,7 @@ struct TypePackFamily

/// The reducer function for the type pack family.
std::function<TypeFamilyReductionResult<TypePackId>(std::vector<TypeId>, std::vector<TypePackId>, NotNull<TypeArena>, NotNull<BuiltinTypes>,
NotNull<TxnLog>, NotNull<Scope>, NotNull<Normalizer>)>
NotNull<TxnLog>, NotNull<Scope>, NotNull<Normalizer>, ConstraintSolver*)>
reducer;
};

Expand All @@ -81,37 +81,69 @@ struct FamilyGraphReductionResult
DenseHashSet<TypePackId> reducedPacks{nullptr};
};

/**
* Attempt to reduce all instances of any type or type pack family in the type
* graph provided.
*
* @param entrypoint the entry point to the type graph.
* @param location the location the reduction is occurring at; used to populate
* type errors.
* @param arena an arena to allocate types into.
* @param builtins the built-in types.
* @param normalizer the normalizer to use when normalizing types
* @param log a TxnLog to use. If one is provided, substitution will take place
* against the TxnLog, otherwise substitutions will directly mutate the type
* graph. Do not provide the empty TxnLog, as a result.
*/
FamilyGraphReductionResult reduceFamilies(TypeId entrypoint, Location location, NotNull<TypeArena> arena, NotNull<BuiltinTypes> builtins,
NotNull<Scope> scope, NotNull<Normalizer> normalizer, TxnLog* log = nullptr, bool force = false);

/**
* Attempt to reduce all instances of any type or type pack family in the type
* graph provided.
*
* @param entrypoint the entry point to the type graph.
* @param location the location the reduction is occurring at; used to populate
* type errors.
* @param arena an arena to allocate types into.
* @param builtins the built-in types.
* @param normalizer the normalizer to use when normalizing types
* @param log a TxnLog to use. If one is provided, substitution will take place
* against the TxnLog, otherwise substitutions will directly mutate the type
* graph. Do not provide the empty TxnLog, as a result.
*/
FamilyGraphReductionResult reduceFamilies(TypePackId entrypoint, Location location, NotNull<TypeArena> arena, NotNull<BuiltinTypes> builtins,
NotNull<Scope> scope, NotNull<Normalizer> normalizer, TxnLog* log = nullptr, bool force = false);

/**
* Attempt to reduce all instances of any type or type pack family in the type
* graph provided.
*
* @param solver the constraint solver this reduction is being performed in.
* @param entrypoint the entry point to the type graph.
* @param location the location the reduction is occurring at; used to populate
* type errors.
* @param arena an arena to allocate types into.
* @param builtins the built-in types.
* @param log a TxnLog to use. If one is provided, substitution will take place
* against the TxnLog, otherwise substitutions will directly mutate the type
* graph. Do not provide the empty TxnLog, as a result.
*/
FamilyGraphReductionResult reduceFamilies(TypeId entrypoint, Location location, NotNull<TypeArena> arena, NotNull<BuiltinTypes> builtins,
NotNull<Scope> scope, NotNull<Normalizer> normalizer, TxnLog* log = nullptr, bool force = false);
FamilyGraphReductionResult reduceFamilies(
NotNull<ConstraintSolver> solver, TypeId entrypoint, Location location, NotNull<Scope> scope, TxnLog* log = nullptr, bool force = false);

/**
* Attempt to reduce all instances of any type or type pack family in the type
* graph provided.
*
* @param solver the constraint solver this reduction is being performed in.
* @param entrypoint the entry point to the type graph.
* @param location the location the reduction is occurring at; used to populate
* type errors.
* @param arena an arena to allocate types into.
* @param builtins the built-in types.
* @param log a TxnLog to use. If one is provided, substitution will take place
* against the TxnLog, otherwise substitutions will directly mutate the type
* graph. Do not provide the empty TxnLog, as a result.
*/
FamilyGraphReductionResult reduceFamilies(TypePackId entrypoint, Location location, NotNull<TypeArena> arena, NotNull<BuiltinTypes> builtins,
NotNull<Scope> scope, NotNull<Normalizer> normalizer, TxnLog* log = nullptr, bool force = false);
FamilyGraphReductionResult reduceFamilies(
NotNull<ConstraintSolver> solver, TypePackId entrypoint, Location location, NotNull<Scope> scope, TxnLog* log = nullptr, bool force = false);

struct BuiltinTypeFamilies
{
Expand Down
42 changes: 40 additions & 2 deletions Analysis/include/Luau/Unifier2.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#include "Luau/DenseHash.h"
#include "Luau/NotNull.h"
#include "Type.h"
#include "TypeCheckLimits.h"
#include "TypeChecker2.h"

#include <optional>
#include <vector>
Expand All @@ -26,16 +29,44 @@ enum class OccursCheckResult
Fail
};

struct TypePairHash
{
size_t hashOne(Luau::TypeId key) const
{
return (uintptr_t(key) >> 4) ^ (uintptr_t(key) >> 9);
}

size_t hashOne(Luau::TypePackId key) const
{
return (uintptr_t(key) >> 4) ^ (uintptr_t(key) >> 9);
}

size_t operator()(const std::pair<Luau::TypeId, Luau::TypeId>& x) const
{
return hashOne(x.first) ^ (hashOne(x.second) << 1);
}

size_t operator()(const std::pair<Luau::TypePackId, Luau::TypePackId>& x) const
{
return hashOne(x.first) ^ (hashOne(x.second) << 1);
}
};

struct Unifier2
{
NotNull<TypeArena> arena;
NotNull<BuiltinTypes> builtinTypes;
NotNull<Scope> scope;
NotNull<InternalErrorReporter> ice;
TypeCheckLimits limits;

DenseHashSet<std::pair<TypeId, TypeId>, TypePairHash> seenTypePairings{{nullptr, nullptr}};
DenseHashSet<std::pair<TypePackId, TypePackId>, TypePairHash> seenTypePackPairings{{nullptr, nullptr}};

int recursionCount = 0;
int recursionLimit = 0;

Unifier2(NotNull<TypeArena> arena, NotNull<BuiltinTypes> builtinTypes, NotNull<InternalErrorReporter> ice);
Unifier2(NotNull<TypeArena> arena, NotNull<BuiltinTypes> builtinTypes, NotNull<Scope> scope, NotNull<InternalErrorReporter> ice);

/** Attempt to commit the subtype relation subTy <: superTy to the type
* graph.
Expand All @@ -50,11 +81,18 @@ struct Unifier2
* free TypePack to another and encounter an occurs check violation.
*/
bool unify(TypeId subTy, TypeId superTy);
bool unify(TypeId subTy, const FunctionType* superFn);
bool unify(const UnionType* subUnion, TypeId superTy);
bool unify(TypeId subTy, const UnionType* superUnion);
bool unify(const IntersectionType* subIntersection, TypeId superTy);
bool unify(TypeId subTy, const IntersectionType* superIntersection);
bool unify(const TableType* subTable, const TableType* superTable);
bool unify(const MetatableType* subMetatable, const MetatableType* superMetatable);

// TODO think about this one carefully. We don't do unions or intersections of type packs
bool unify(TypePackId subTp, TypePackId superTp);

std::optional<TypeId> generalize(NotNull<Scope> scope, TypeId ty);
std::optional<TypeId> generalize(TypeId ty);

private:
/**
Expand Down
15 changes: 10 additions & 5 deletions Analysis/include/Luau/VisitType.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,16 @@ struct GenericTypeVisitor
{
if (visit(ty, *ftv))
{
LUAU_ASSERT(ftv->lowerBound);
traverse(ftv->lowerBound);

LUAU_ASSERT(ftv->upperBound);
traverse(ftv->upperBound);
// TODO: Replace these if statements with assert()s when we
// delete FFlag::DebugLuauDeferredConstraintResolution.
//
// When the old solver is used, these pointers are always
// unused. When the new solver is used, they are never null.
if (ftv->lowerBound)
traverse(ftv->lowerBound);

if (ftv->upperBound)
traverse(ftv->upperBound);
}
}
else
Expand Down
39 changes: 12 additions & 27 deletions Analysis/src/AstQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <algorithm>

LUAU_FASTFLAG(DebugLuauReadWriteProperties)
LUAU_FASTFLAGVARIABLE(FixFindBindingAtFunctionName, false);

namespace Luau
{
Expand Down Expand Up @@ -151,19 +150,12 @@ struct FindNode : public AstVisitor

bool visit(AstStatFunction* node) override
{
if (FFlag::FixFindBindingAtFunctionName)
{
visit(static_cast<AstNode*>(node));
if (node->name->location.contains(pos))
node->name->visit(this);
else if (node->func->location.contains(pos))
node->func->visit(this);
return false;
}
else
{
return AstVisitor::visit(node);
}
visit(static_cast<AstNode*>(node));
if (node->name->location.contains(pos))
node->name->visit(this);
else if (node->func->location.contains(pos))
node->func->visit(this);
return false;
}

bool visit(AstStatBlock* block) override
Expand Down Expand Up @@ -208,19 +200,12 @@ struct FindFullAncestry final : public AstVisitor

bool visit(AstStatFunction* node) override
{
if (FFlag::FixFindBindingAtFunctionName)
{
visit(static_cast<AstNode*>(node));
if (node->name->location.contains(pos))
node->name->visit(this);
else if (node->func->location.contains(pos))
node->func->visit(this);
return false;
}
else
{
return AstVisitor::visit(node);
}
visit(static_cast<AstNode*>(node));
if (node->name->location.contains(pos))
node->name->visit(this);
else if (node->func->location.contains(pos))
node->func->visit(this);
return false;
}

bool visit(AstNode* node) override
Expand Down
Loading
Loading