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/570 #885

Merged
merged 99 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 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
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
18 changes: 15 additions & 3 deletions Analysis/include/Luau/ConstraintSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ struct ConstraintSolver
NotNull<BuiltinTypes> builtinTypes;
InternalErrorReporter iceReporter;
NotNull<Normalizer> normalizer;
NotNull<TypeReduction> reducer;
// The entire set of constraints that the solver is trying to resolve.
std::vector<NotNull<Constraint>> constraints;
NotNull<Scope> rootScope;
Expand Down Expand Up @@ -85,8 +84,7 @@ struct ConstraintSolver
DcrLogger* logger;

explicit ConstraintSolver(NotNull<Normalizer> normalizer, NotNull<Scope> rootScope, std::vector<NotNull<Constraint>> constraints,
ModuleName moduleName, NotNull<TypeReduction> reducer, NotNull<ModuleResolver> moduleResolver, std::vector<RequireCycle> requireCycles,
DcrLogger* logger);
ModuleName moduleName, NotNull<ModuleResolver> moduleResolver, std::vector<RequireCycle> requireCycles, DcrLogger* logger);

// Randomize the order in which to dispatch constraints
void randomize(unsigned seed);
Expand Down Expand Up @@ -219,6 +217,20 @@ struct ConstraintSolver
void reportError(TypeError e);

private:

/** Helper used by tryDispatch(SubtypeConstraint) and
* tryDispatch(PackSubtypeConstraint)
*
* Attempts to unify subTy with superTy. If doing so would require unifying
* BlockedTypes, fail and block the constraint on those BlockedTypes.
*
* If unification fails, replace all free types with errorType.
*
* If unification succeeds, unblock every type changed by the unification.
*/
template <typename TID>
bool tryUnify(NotNull<const Constraint> constraint, TID subTy, TID superTy);

/**
* Marks a constraint as being blocked on a type or type pack. The constraint
* solver will not attempt to dispatch blocked constraints until their
Expand Down
6 changes: 1 addition & 5 deletions Analysis/include/Luau/Normalize.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,8 @@ struct NormalizedClassType
// this type may contain `error`.
struct NormalizedFunctionType
{
NormalizedFunctionType();

bool isTop = false;
// TODO: Remove this wrapping optional when clipping
// FFlagLuauNegatedFunctionTypes.
std::optional<TypeIds> parts;
TypeIds parts;

void resetToNever();
void resetToTop();
Expand Down
6 changes: 3 additions & 3 deletions Analysis/include/Luau/Scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ struct Scope
std::optional<TypeId> lookup(DefId def) const;
std::optional<std::pair<Binding*, Scope*>> lookupEx(Symbol sym);

std::optional<TypeFun> lookupType(const Name& name);
std::optional<TypeFun> lookupImportedType(const Name& moduleAlias, const Name& name);
std::optional<TypeFun> lookupType(const Name& name) const;
std::optional<TypeFun> lookupImportedType(const Name& moduleAlias, const Name& name) const;

std::unordered_map<Name, TypePackId> privateTypePackBindings;
std::optional<TypePackId> lookupPack(const Name& name);
std::optional<TypePackId> lookupPack(const Name& name) const;

// WARNING: This function linearly scans for a string key of equal value! It is thus O(n**2)
std::optional<Binding> linearSearchForBinding(const std::string& name, bool traverseScopeChain = true) const;
Expand Down
6 changes: 3 additions & 3 deletions Analysis/include/Luau/TypeInfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ struct GlobalTypes
// within a program are borrowed pointers into this set.
struct TypeChecker
{
explicit TypeChecker(const GlobalTypes& globals, ModuleResolver* resolver, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter* iceHandler);
explicit TypeChecker(
const ScopePtr& globalScope, ModuleResolver* resolver, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter* iceHandler);
TypeChecker(const TypeChecker&) = delete;
TypeChecker& operator=(const TypeChecker&) = delete;

Expand Down Expand Up @@ -367,8 +368,7 @@ struct TypeChecker
*/
std::vector<TypeId> unTypePack(const ScopePtr& scope, TypePackId pack, size_t expectedLength, const Location& location);

// TODO: only const version of global scope should be available to make sure nothing else is modified inside of from users of TypeChecker
const GlobalTypes& globals;
const ScopePtr& globalScope;

ModuleResolver* resolver;
ModulePtr currentModule;
Expand Down
22 changes: 4 additions & 18 deletions Analysis/src/AstQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

#include <algorithm>

LUAU_FASTFLAG(LuauCompleteTableKeysBetter);

namespace Luau
{

Expand All @@ -31,24 +29,12 @@ struct AutocompleteNodeFinder : public AstVisitor

bool visit(AstExpr* expr) override
{
if (FFlag::LuauCompleteTableKeysBetter)
{
if (expr->location.begin <= pos && pos <= expr->location.end)
{
ancestry.push_back(expr);
return true;
}
return false;
}
else
if (expr->location.begin <= pos && pos <= expr->location.end)
{
if (expr->location.begin < pos && pos <= expr->location.end)
{
ancestry.push_back(expr);
return true;
}
return false;
ancestry.push_back(expr);
return true;
}
return false;
}

bool visit(AstStat* stat) override
Expand Down
51 changes: 18 additions & 33 deletions Analysis/src/Autocomplete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <unordered_set>
#include <utility>

LUAU_FASTFLAGVARIABLE(LuauCompleteTableKeysBetter, false);
LUAU_FASTFLAGVARIABLE(LuauAutocompleteSkipNormalization, false);

static const std::unordered_set<std::string> kStatementStartingKeywords = {
Expand Down Expand Up @@ -981,25 +980,14 @@ T* extractStat(const std::vector<AstNode*>& ancestry)
AstNode* grandParent = ancestry.size() >= 3 ? ancestry.rbegin()[2] : nullptr;
AstNode* greatGrandParent = ancestry.size() >= 4 ? ancestry.rbegin()[3] : nullptr;

if (FFlag::LuauCompleteTableKeysBetter)
{
if (!grandParent)
return nullptr;

if (T* t = parent->as<T>(); t && grandParent->is<AstStatBlock>())
return t;
if (!grandParent)
return nullptr;

if (!greatGrandParent)
return nullptr;
}
else
{
if (T* t = parent->as<T>(); t && parent->is<AstStatBlock>())
return t;
if (T* t = parent->as<T>(); t && grandParent->is<AstStatBlock>())
return t;

if (!grandParent || !greatGrandParent)
return nullptr;
}
if (!greatGrandParent)
return nullptr;

if (T* t = greatGrandParent->as<T>(); t && grandParent->is<AstStatBlock>() && parent->is<AstStatError>() && isIdentifier(node))
return t;
Expand Down Expand Up @@ -1533,23 +1521,20 @@ static AutocompleteResult autocomplete(const SourceModule& sourceModule, const M
{
auto result = autocompleteProps(*module, typeArena, builtinTypes, *it, PropIndexType::Key, ancestry);

if (FFlag::LuauCompleteTableKeysBetter)
{
if (auto nodeIt = module->astExpectedTypes.find(node->asExpr()))
autocompleteStringSingleton(*nodeIt, !node->is<AstExprConstantString>(), result);
if (auto nodeIt = module->astExpectedTypes.find(node->asExpr()))
autocompleteStringSingleton(*nodeIt, !node->is<AstExprConstantString>(), result);

if (!key)
if (!key)
{
// If there is "no key," it may be that the user
// intends for the current token to be the key, but
// has yet to type the `=` sign.
//
// If the key type is a union of singleton strings,
// suggest those too.
if (auto ttv = get<TableType>(follow(*it)); ttv && ttv->indexer)
{
// If there is "no key," it may be that the user
// intends for the current token to be the key, but
// has yet to type the `=` sign.
//
// If the key type is a union of singleton strings,
// suggest those too.
if (auto ttv = get<TableType>(follow(*it)); ttv && ttv->indexer)
{
autocompleteStringSingleton(ttv->indexer->indexType, false, result);
}
autocompleteStringSingleton(ttv->indexer->indexType, false, result);
}
}

Expand Down
25 changes: 9 additions & 16 deletions Analysis/src/BuiltinDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

#include <algorithm>

LUAU_FASTFLAGVARIABLE(LuauDeprecateTableGetnForeach, false)

/** FIXME: Many of these type definitions are not quite completely accurate.
*
* Some of them require richer generics than we have. For instance, we do not yet have a way to talk
Expand Down Expand Up @@ -298,13 +296,10 @@ void registerBuiltinGlobals(TypeChecker& typeChecker, GlobalTypes& globals)
ttv->props["freeze"] = makeProperty(makeFunction(arena, std::nullopt, {tabTy}, {tabTy}), "@luau/global/table.freeze");
ttv->props["clone"] = makeProperty(makeFunction(arena, std::nullopt, {tabTy}, {tabTy}), "@luau/global/table.clone");

if (FFlag::LuauDeprecateTableGetnForeach)
{
ttv->props["getn"].deprecated = true;
ttv->props["getn"].deprecatedSuggestion = "#";
ttv->props["foreach"].deprecated = true;
ttv->props["foreachi"].deprecated = true;
}
ttv->props["getn"].deprecated = true;
ttv->props["getn"].deprecatedSuggestion = "#";
ttv->props["foreach"].deprecated = true;
ttv->props["foreachi"].deprecated = true;

attachMagicFunction(ttv->props["pack"].type, magicFunctionPack);
attachDcrMagicFunction(ttv->props["pack"].type, dcrMagicFunctionPack);
Expand Down Expand Up @@ -401,15 +396,13 @@ void registerBuiltinGlobals(Frontend& frontend)
ttv->props["freeze"] = makeProperty(makeFunction(arena, std::nullopt, {tabTy}, {tabTy}), "@luau/global/table.freeze");
ttv->props["clone"] = makeProperty(makeFunction(arena, std::nullopt, {tabTy}, {tabTy}), "@luau/global/table.clone");

if (FFlag::LuauDeprecateTableGetnForeach)
{
ttv->props["getn"].deprecated = true;
ttv->props["getn"].deprecatedSuggestion = "#";
ttv->props["foreach"].deprecated = true;
ttv->props["foreachi"].deprecated = true;
}
ttv->props["getn"].deprecated = true;
ttv->props["getn"].deprecatedSuggestion = "#";
ttv->props["foreach"].deprecated = true;
ttv->props["foreachi"].deprecated = true;

attachMagicFunction(ttv->props["pack"].type, magicFunctionPack);
attachDcrMagicFunction(ttv->props["pack"].type, dcrMagicFunctionPack);
}

attachMagicFunction(getGlobalBinding(globals, "require"), magicFunctionRequire);
Expand Down
Loading