Skip to content

Commit

Permalink
Sync to upstream/release/618 (#1205)
Browse files Browse the repository at this point in the history
# What's changed

### Debugger

* Values after a 'continue' statement should not be accessible by
debugger in the 'until' condition

### New Type Solver

* Many fixes to crashes and hangs
* Better bidirectional inference of table literal expressions

### Native Code Generation

* Initial steps toward a shared code allocator

---

### Internal Contributors

Co-authored-by: Aaron Weiss <aaronweiss@roblox.com>
Co-authored-by: Lily Brown <lbrown@roblox.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
  • Loading branch information
4 people committed Mar 22, 2024
1 parent d21b6fd commit c1830d8
Show file tree
Hide file tree
Showing 51 changed files with 2,335 additions and 435 deletions.
1 change: 1 addition & 0 deletions Analysis/include/Luau/Constraint.h
Expand Up @@ -112,6 +112,7 @@ struct FunctionCheckConstraint
TypePackId argsPack;

class AstExprCall* callSite = nullptr;
NotNull<DenseHashMap<const AstExpr*, TypeId>> astTypes;
NotNull<DenseHashMap<const AstExpr*, TypeId>> astExpectedTypes;
};

Expand Down
6 changes: 5 additions & 1 deletion Analysis/include/Luau/ConstraintSolver.h
Expand Up @@ -277,8 +277,12 @@ struct ConstraintSolver
*
* To determine which scope is appropriate, we also accept rootTy, which is
* to be the type that contains blockedTy.
*
* A constraint is required and will validate that blockedTy is owned by this
* constraint. This prevents one constraint from interfering with another's
* blocked types.
*/
void bindBlockedType(TypeId blockedTy, TypeId resultTy, TypeId rootTy, Location location);
void bindBlockedType(TypeId blockedTy, TypeId resultTy, TypeId rootTy, NotNull<const Constraint> constraint);

/**
* Marks a constraint as being blocked on a type or type pack. The constraint
Expand Down
1 change: 1 addition & 0 deletions Analysis/include/Luau/Instantiation2.h
Expand Up @@ -61,6 +61,7 @@ struct Instantiation2 : Substitution
{
}

bool ignoreChildren(TypeId ty) override;
bool isDirty(TypeId ty) override;
bool isDirty(TypePackId tp) override;
TypeId clean(TypeId ty) override;
Expand Down
11 changes: 11 additions & 0 deletions Analysis/include/Luau/Set.h
Expand Up @@ -53,6 +53,17 @@ class Set
insert(*it);
}

void erase(T&& element)
{
bool& entry = mapping[element];

if (entry)
{
entry = false;
entryCount--;
}
}

void erase(const T& element)
{
bool& entry = mapping[element];
Expand Down
28 changes: 28 additions & 0 deletions Analysis/include/Luau/TableLiteralInference.h
@@ -0,0 +1,28 @@
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details

#pragma once

#include "Luau/DenseHash.h"
#include "Luau/NotNull.h"
#include "Luau/TypeFwd.h"

namespace Luau
{

struct TypeArena;
struct BuiltinTypes;
struct Unifier2;
class AstExpr;

TypeId matchLiteralType(
NotNull<DenseHashMap<const AstExpr*, TypeId>> astTypes,
NotNull<DenseHashMap<const AstExpr*, TypeId>> astExpectedTypes,
NotNull<BuiltinTypes> builtinTypes,
NotNull<TypeArena> arena,
NotNull<Unifier2> unifier,
TypeId expectedType,
TypeId exprType,
const AstExpr* expr
);

}
7 changes: 7 additions & 0 deletions Analysis/include/Luau/Type.h
Expand Up @@ -146,6 +146,10 @@ struct BlockedType
BlockedType();
int index;

Constraint* getOwner() const;
void setOwner(Constraint* newOwner);

private:
// The constraint that is intended to unblock this type. Other constraints
// should block on this constraint if present.
Constraint* owner = nullptr;
Expand Down Expand Up @@ -419,6 +423,9 @@ struct Property
TypeId type() const;
void setType(TypeId ty);

// Sets the write type of this property to the read type.
void makeShared();

bool isShared() const;
bool isReadOnly() const;
bool isWriteOnly() const;
Expand Down
2 changes: 2 additions & 0 deletions Analysis/include/Luau/TypePack.h
Expand Up @@ -82,6 +82,8 @@ struct BlockedTypePack
BlockedTypePack();
size_t index;

struct Constraint* owner = nullptr;

static size_t nextIndex;
};

Expand Down

0 comments on commit c1830d8

Please sign in to comment.