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/642 #1385

Merged
merged 147 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
a0b9950
Sync to upstream/release/602
aatxe Nov 3, 2023
efe133a
Merge branch 'upstream' into merge
aatxe Nov 3, 2023
4b68791
Sync to upstream/release/603
alexmccord Nov 10, 2023
6343648
Merge branch 'master' into merge
alexmccord Nov 10, 2023
e57cbf6
Merge branch 'heads/upstream' into merge
alexmccord Nov 10, 2023
674c6c4
Sync to upstream/release/604
andyfriesen Nov 17, 2023
4320153
Merge branch 'master' into merge
andyfriesen Nov 17, 2023
2d4a544
Merge branch 'upstream' into merge
andyfriesen Nov 17, 2023
557e77a
VM
Vighnesh-V Dec 2, 2023
98d2db7
add stdint import
Vighnesh-V Dec 2, 2023
e70eec0
Merge branch 'upstream' into merge
Vighnesh-V Dec 2, 2023
7985414
resolve one last merge conflict
Vighnesh-V Dec 2, 2023
c592f50
can CI handle this?
Vighnesh-V Dec 2, 2023
41669c9
Sync to upstream/release/605
Vighnesh-V Dec 2, 2023
c932b8e
remove tests for require by string
Vighnesh-V Dec 2, 2023
c48ffc3
endif
Vighnesh-V Dec 2, 2023
69728e8
Sync to upstream/release/606
vegorov-rbx Dec 8, 2023
f5441d7
Merge branch 'master' into merge
vegorov-rbx Dec 8, 2023
6068432
Merge branch 'upstream' into merge
vegorov-rbx Dec 8, 2023
139b169
Merge fix
vegorov-rbx Dec 8, 2023
f9c5cdd
Sync to upstream/release/607
aatxe Dec 15, 2023
89090a1
Merge branch 'master' into merge
aatxe Dec 15, 2023
d622618
Merge branch 'upstream' into merge
aatxe Dec 15, 2023
adea0f8
fix ubuntu build with import for cstddef in DenseHash
aatxe Dec 15, 2023
d4883bf
Merge branch 'upstream' of https://github.com/luau-lang/luau into ups…
Vighnesh-V Jan 11, 2024
0d5c842
Sync to upstream/release/608
Vighnesh-V Jan 12, 2024
74b0d00
Merge branch 'master' into merge
Vighnesh-V Jan 12, 2024
7932835
Merge branch 'upstream' into merge
Vighnesh-V Jan 12, 2024
50b4779
Sync to upstream/release/608
Vighnesh-V Jan 12, 2024
2f7509d
Merge branch 'upstream' into merge
Vighnesh-V Jan 12, 2024
38aa074
resolve memory leak in VecDeque
Vighnesh-V Jan 12, 2024
064d845
Sync to upstream/release/609
vegorov-rbx Jan 19, 2024
59a29fd
Merge branch 'master' into merge
vegorov-rbx Jan 19, 2024
2fd3da3
Merge branch 'upstream' into merge
vegorov-rbx Jan 19, 2024
0edacdd
Sync to upstream/release/610
aatxe Jan 27, 2024
e3aba92
Merge branch 'master' into merge
aatxe Jan 27, 2024
ce2665d
Merge branch 'upstream' into merge
aatxe Jan 27, 2024
dfa512b
Sync to upstream/release/611
alexmccord Feb 2, 2024
f8f0dd9
Merge branch 'master' into merge
alexmccord Feb 2, 2024
88d2b93
Merge branch 'heads/upstream' into merge
alexmccord Feb 2, 2024
5559c7f
Fix the stack-use-after-scope.
alexmccord Feb 2, 2024
1a6da94
Sync to upstream/release/612
andyfriesen Feb 9, 2024
45e72ee
Merge branch 'master' into merge
andyfriesen Feb 9, 2024
ffd9f32
Merge branch 'upstream' into merge
andyfriesen Feb 9, 2024
158d60c
Sync to upstream/release/613
vegorov-rbx Feb 16, 2024
1778950
Merge branch 'master' into merge
vegorov-rbx Feb 16, 2024
b5f2813
Merge branch 'upstream' into merge
vegorov-rbx Feb 16, 2024
22686ef
Sync to upstream/release/614
Vighnesh-V Feb 23, 2024
ccb5385
Merge branch 'master' into merge
Vighnesh-V Feb 23, 2024
0ab33af
Merge branch 'upstream' into merge
Vighnesh-V Feb 23, 2024
d4a2665
Sync to upstream/release/615
vegorov-rbx Mar 1, 2024
532fd10
Merge branch 'master' into merge
vegorov-rbx Mar 1, 2024
f36cae2
Merge branch 'upstream' into merge
vegorov-rbx Mar 1, 2024
ed4ce84
Merge fixes
vegorov-rbx Mar 1, 2024
27a05c0
Sync to upstream/release/616
aatxe Mar 8, 2024
9e1a26c
Merge branch 'master' into merge
aatxe Mar 8, 2024
1ebdfe0
Merge branch 'upstream' into merge
aatxe Mar 9, 2024
f27d4f5
Sync to upstream/release/617
alexmccord Mar 15, 2024
5e9a567
Merge branch 'master' into merge
alexmccord Mar 15, 2024
c1bbf1e
Merge branch 'heads/upstream' into merge
alexmccord Mar 15, 2024
6fff08b
Sync to upstream/release/618
andyfriesen Mar 22, 2024
a30b2ae
Merge branch 'master' into merge
andyfriesen Mar 22, 2024
4931165
Merge branch 'upstream' into merge
andyfriesen Mar 22, 2024
d8f49d6
Compiler fixes for MSVC and GCC.
andyfriesen Mar 22, 2024
fb90dc0
Sync with upstream/release/620
AmaranthineCodices Mar 30, 2024
77598ed
Merge branch 'master' into merge
AmaranthineCodices Mar 30, 2024
3e1b413
Merge branch 'upstream' into merge
AmaranthineCodices Mar 30, 2024
c730a51
Sync to upstream/release/620
Vighnesh-V Apr 5, 2024
6bef0b1
Merge branch 'master' into merge
Vighnesh-V Apr 5, 2024
2e1c040
Merge branch 'upstream' into merge
Vighnesh-V Apr 5, 2024
9cb93a9
manually fix cmake configuration error
Vighnesh-V Apr 5, 2024
0f19739
remove trailing .
Vighnesh-V Apr 5, 2024
5aa6d99
transplant game engine fix for memory safety issues in normalization …
Vighnesh-V Apr 5, 2024
0f0c0e4
Sync to upstream/release/621
vegorov-rbx Apr 12, 2024
7c346a0
Merge branch 'master' into merge
vegorov-rbx Apr 12, 2024
f97e96d
Merge branch 'upstream' into merge
vegorov-rbx Apr 12, 2024
858b93a
Sync fixup
vegorov-rbx Apr 12, 2024
67b9145
Sync to upstream/release/622
aatxe Apr 19, 2024
5cf508a
Merge branch 'master' into merge
aatxe Apr 19, 2024
641e9f6
Merge branch 'upstream' into merge
aatxe Apr 19, 2024
50a2f8d
Sync to upstream/release/623
alexmccord Apr 25, 2024
8d0a650
Merge branch 'master' into merge
alexmccord Apr 25, 2024
76ed1a5
Merge branch 'heads/upstream' into merge
alexmccord Apr 25, 2024
88dd289
Fix missing include.
alexmccord Apr 25, 2024
93468ca
Sync to upstream/release/624
andyfriesen May 3, 2024
f4ecf43
Merge branch 'master' into merge
andyfriesen May 3, 2024
1ad7b9c
Merge branch 'upstream' into merge
andyfriesen May 3, 2024
9bce20c
Sync to upstream/release/625
Vighnesh-V May 10, 2024
f76a99b
Merge branch 'master' into merge
Vighnesh-V May 10, 2024
f172471
Merge branch 'upstream' into merge
Vighnesh-V May 10, 2024
0386eec
Sync to upstream/release/626
vegorov-rbx May 16, 2024
e5de2ed
Merge branch 'master' into merge
vegorov-rbx May 16, 2024
ca46dd6
Merge branch 'upstream' into merge
vegorov-rbx May 16, 2024
0f61e4e
Merge fix
vegorov-rbx May 16, 2024
bad9e14
627
aatxe May 26, 2024
26fb155
Merge branch 'master' into merge
aatxe May 26, 2024
241fcf8
Merge branch 'upstream' into merge
aatxe May 26, 2024
fede4d6
Sync to upstream/release/628
alexmccord May 31, 2024
09e46d1
Merge branch 'master' into merge
alexmccord May 31, 2024
93a89dc
Merge branch 'heads/upstream' into merge
alexmccord May 31, 2024
5dd9735
Sync to upstream/release/629
andyfriesen Jun 7, 2024
eae092a
Merge branch 'master' into merge
andyfriesen Jun 7, 2024
40e0316
Merge branch 'upstream' into merge
andyfriesen Jun 7, 2024
58b9809
Sync to upstream/release/630
Vighnesh-V Jun 14, 2024
91790ef
Merge branch 'master' into merge
Vighnesh-V Jun 14, 2024
2a1359d
Merge branch 'upstream' into merge
Vighnesh-V Jun 14, 2024
1ba3e5f
correct the flag name
Vighnesh-V Jun 14, 2024
816cb1d
Sync to upstream/release/631
vegorov-rbx Jun 20, 2024
5d2e3de
Merge branch 'master' into merge
vegorov-rbx Jun 20, 2024
dafb44d
Merge branch 'upstream' into merge
vegorov-rbx Jun 20, 2024
240a9d8
Sync to upstream/release/632
aatxe Jun 29, 2024
c5a2a4b
Merge branch 'master' into merge
aatxe Jun 29, 2024
da48758
Merge branch 'upstream' into merge
aatxe Jun 29, 2024
cfcb545
Sync to upstream/release/633
Vighnesh-V Jul 8, 2024
2010be1
Merge branch 'master' into merge
Vighnesh-V Jul 8, 2024
bc1bead
Merge branch 'upstream' into merge
Vighnesh-V Jul 8, 2024
1c1476f
Sync to upstream/release/634
joonyoo181 Jul 11, 2024
a62f661
Merge branch 'master' into merge
joonyoo181 Jul 11, 2024
5a23350
Merge branch 'upstream' into merge
joonyoo181 Jul 11, 2024
6fd26c5
Sync to upstream/release/635
Vighnesh-V Jul 19, 2024
79966e9
Merge branch 'master' into merge
Vighnesh-V Jul 19, 2024
ac97a49
Merge branch 'upstream' into merge
Vighnesh-V Jul 19, 2024
7dd10b1
Sync to upstream/release/636
joonyoo181 Jul 26, 2024
fab4eec
Merge branch 'master' into merge
joonyoo181 Jul 26, 2024
48c0e9f
Merge branch 'upstream' into merge
joonyoo181 Jul 26, 2024
bb7d5cf
StudioReportLuauAny added to ExperimentalFlags
joonyoo181 Jul 26, 2024
28c48cf
Skip StudioReportLuauAny flag in tests
joonyoo181 Jul 26, 2024
fad8aaf
Sync to upstream/release/637
joonyoo181 Aug 1, 2024
5b40152
Merge branch 'master' into merge
joonyoo181 Aug 1, 2024
1adbd45
Merge branch 'upstream' into merge
joonyoo181 Aug 1, 2024
8a99f25
Sync to upstream/release/638
andyfriesen Aug 9, 2024
057bdf3
Merge branch 'master' into merge
andyfriesen Aug 9, 2024
c229a9e
Merge branch 'upstream' into merge
andyfriesen Aug 9, 2024
497c3ed
Sync to upstream/release/639
Vighnesh-V Aug 16, 2024
8c4f907
Merge branch 'master' into merge
Vighnesh-V Aug 16, 2024
3613ee9
Merge branch 'upstream' into merge
Vighnesh-V Aug 16, 2024
ebdbcb1
Sync to upstream/release/640
vegorov-rbx Aug 23, 2024
caeba5a
Merge branch 'master' into merge
vegorov-rbx Aug 23, 2024
d414b56
Merge branch 'upstream' into merge
vegorov-rbx Aug 23, 2024
5b9344a
Missing sync elements
vegorov-rbx Aug 23, 2024
25db8ff
Success, DCR mode no longer fails any tests
vegorov-rbx Aug 23, 2024
a74031b
Sync release to upstream/release/641
aatxe Aug 30, 2024
78ae885
Merge branch 'master' into merge
aatxe Aug 30, 2024
f86f0a4
Merge branch 'upstream' into merge
aatxe Aug 30, 2024
15557d8
Sync to upstream/release/642
andyfriesen Sep 6, 2024
538b0c0
Merge branch 'master' into merge
andyfriesen Sep 6, 2024
ef8e1e3
Merge branch 'upstream' into merge
andyfriesen Sep 6, 2024
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
3 changes: 1 addition & 2 deletions Analysis/src/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <algorithm>

LUAU_FASTFLAG(LuauSolverV2);
LUAU_FASTFLAGVARIABLE(LuauSkipEmptyInstantiations, false);

namespace Luau
{
Expand Down Expand Up @@ -122,7 +121,7 @@ struct ClonePublicInterface : Substitution

if (FunctionType* ftv = getMutable<FunctionType>(result))
{
if (FFlag::LuauSkipEmptyInstantiations && ftv->generics.empty() && ftv->genericPacks.empty())
if (ftv->generics.empty() && ftv->genericPacks.empty())
{
GenericTypeFinder marker;
marker.traverse(result);
Expand Down
70 changes: 52 additions & 18 deletions Analysis/src/TypeFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,30 @@ bool computeKeysOf(TypeId ty, Set<std::string>& result, DenseHashSet<TypeId>& se
return res;
}

// this should not be reachable since the type should be a valid tables part from normalization.
if (auto classTy = get<ClassType>(ty))
{
for (auto [key, _] : classTy->props)
result.insert(key);

bool res = true;
if (classTy->metatable && !isRaw)
{
// findMetatableEntry demands the ability to emit errors, so we must give it
// the necessary state to do that, even if we intend to just eat the errors.
ErrorVec dummy;

std::optional<TypeId> mmType = findMetatableEntry(ctx->builtins, dummy, ty, "__index", Location{});
if (mmType)
res = res && computeKeysOf(*mmType, result, seen, isRaw, ctx);
}

if (classTy->parent)
res = res && computeKeysOf(follow(*classTy->parent), result, seen, isRaw, ctx);

return res;
}

// this should not be reachable since the type should be a valid tables or classes part from normalization.
LUAU_ASSERT(false);
return false;
}
Expand Down Expand Up @@ -1941,34 +1964,32 @@ TypeFunctionReductionResult<TypeId> keyofFunctionImpl(
{
LUAU_ASSERT(!normTy->hasTables());

// seen set for key computation for classes
DenseHashSet<TypeId> seen{{}};

auto classesIter = normTy->classes.ordering.begin();
auto classesIterEnd = normTy->classes.ordering.end();
LUAU_ASSERT(classesIter != classesIterEnd); // should be guaranteed by the `hasClasses` check

auto classTy = get<ClassType>(*classesIter);
if (!classTy)
{
LUAU_ASSERT(false); // this should not be possible according to normalization's spec
return {std::nullopt, true, {}, {}};
}
LUAU_ASSERT(classesIter != classesIterEnd); // should be guaranteed by the `hasClasses` check earlier

for (auto [key, _] : classTy->props)
keys.insert(key);
// collect all the properties from the first class type
if (!computeKeysOf(*classesIter, keys, seen, isRaw, ctx))
return {ctx->builtins->stringType, false, {}, {}}; // if it failed, we have a top type!

// we need to look at each class to remove any keys that are not common amongst them all
while (++classesIter != classesIterEnd)
{
auto classTy = get<ClassType>(*classesIter);
if (!classTy)
{
LUAU_ASSERT(false); // this should not be possible according to normalization's spec
return {std::nullopt, true, {}, {}};
}
seen.clear(); // we'll reuse the same seen set

Set<std::string> localKeys{{}};

// we can skip to the next class if this one is a top type
if (!computeKeysOf(*classesIter, localKeys, seen, isRaw, ctx))
continue;

for (auto key : keys)
{
// remove any keys that are not present in each class
if (classTy->props.find(key) == classTy->props.end())
if (!localKeys.contains(key))
keys.erase(key);
}
}
Expand Down Expand Up @@ -2222,6 +2243,19 @@ TypeFunctionReductionResult<TypeId> indexFunctionImpl(
if (searchPropsAndIndexer(ty, classTy->props, classTy->indexer, properties, ctx))
continue; // Indexer was found in this class, so we can move on to the next

auto parent = classTy->parent;
bool foundInParent = false;
while (parent && !foundInParent)
{
auto parentClass = get<ClassType>(follow(*parent));
foundInParent = searchPropsAndIndexer(ty, parentClass->props, parentClass->indexer, properties, ctx);
parent = parentClass->parent;
}

// we move on to the next type if any of the parents we went through had the property.
if (foundInParent)
continue;

// If code reaches here,that means the property not found -> check in the metatable's __index

// findMetatableEntry demands the ability to emit errors, so we must give it
Expand Down
28 changes: 28 additions & 0 deletions tests/TypeFunction.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,20 @@ TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_common_subset_if_union_of_d
LUAU_REQUIRE_NO_ERRORS(result);
}

TEST_CASE_FIXTURE(ClassFixture, "keyof_type_function_works_with_parent_classes_too")
{
if (!FFlag::LuauSolverV2)
return;

CheckResult result = check(R"(
type KeysOfMyObject = keyof<ChildClass>

local function ok(idx: KeysOfMyObject): "BaseField" | "BaseMethod" | "Method" | "Touched" return idx end
)");

LUAU_REQUIRE_NO_ERRORS(result);
}

TEST_CASE_FIXTURE(ClassFixture, "binary_type_function_works_with_default_argument")
{
if (!FFlag::LuauSolverV2)
Expand Down Expand Up @@ -1033,6 +1047,20 @@ TEST_CASE_FIXTURE(ClassFixture, "index_type_function_works_on_classes")
LUAU_REQUIRE_NO_ERRORS(result);
}

TEST_CASE_FIXTURE(ClassFixture, "index_type_function_works_on_classes_with_parents")
{
if (!FFlag::LuauSolverV2)
return;

CheckResult result = check(R"(
type KeysOfMyObject = index<ChildClass, "BaseField">

local function ok(idx: KeysOfMyObject): number return idx end
)");

LUAU_REQUIRE_NO_ERRORS(result);
}

TEST_CASE_FIXTURE(BuiltinsFixture, "index_type_function_works_w_index_metatables")
{
if (!FFlag::LuauSolverV2)
Expand Down
19 changes: 4 additions & 15 deletions tests/TypeInfer.builtins.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "select_with_variadic_typepack_tail_and_strin

TEST_CASE_FIXTURE(Fixture, "string_format_as_method")
{
// CLI-115690
if (FFlag::LuauSolverV2)
return;
ScopedFastFlag sff{FFlag::LuauDCRMagicFunctionTypeChecker, true};

CheckResult result = check("local _ = ('%s'):format(5)");

Expand All @@ -809,6 +807,7 @@ TEST_CASE_FIXTURE(Fixture, "string_format_as_method")

TEST_CASE_FIXTURE(Fixture, "string_format_use_correct_argument")
{
ScopedFastFlag sff{FFlag::LuauDCRMagicFunctionTypeChecker, true};
CheckResult result = check(R"(
local _ = ("%s"):format("%d", "hello")
)");
Expand All @@ -820,10 +819,7 @@ TEST_CASE_FIXTURE(Fixture, "string_format_use_correct_argument")

TEST_CASE_FIXTURE(Fixture, "string_format_use_correct_argument2")
{
// CLI-115690
if (FFlag::LuauSolverV2)
return;

ScopedFastFlag sff{FFlag::LuauDCRMagicFunctionTypeChecker, true};
CheckResult result = check(R"(
local _ = ("%s %d").format("%d %s", "A type error", 2)
)");
Expand Down Expand Up @@ -882,10 +878,7 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "debug_info_is_crazy")

TEST_CASE_FIXTURE(BuiltinsFixture, "aliased_string_format")
{
// CLI-115690
if (FFlag::LuauSolverV2)
return;

ScopedFastFlag sff{FFlag::LuauDCRMagicFunctionTypeChecker, true};
CheckResult result = check(R"(
local fmt = string.format
local s = fmt("%d", "oops")
Expand Down Expand Up @@ -945,10 +938,6 @@ TEST_CASE_FIXTURE(BuiltinsFixture, "select_on_variadic")

TEST_CASE_FIXTURE(BuiltinsFixture, "string_format_report_all_type_errors_at_correct_positions")
{
// CLI-115690
if (FFlag::LuauSolverV2)
return;

ScopedFastFlag sff{FFlag::LuauDCRMagicFunctionTypeChecker, true};
CheckResult result = check(R"(
("%s%d%s"):format(1, "hello", true)
Expand Down
Loading