mirror of
https://github.com/luau-lang/luau.git
synced 2025-02-01 07:13:09 +00:00
e5ec0cdff3
## What's changed - `bit32.byteswap` added ([RFC](4f543ec23b/docs/function-bit32-byteswap.md
)) - Buffer library implementation ([RFC](4f543ec23b/docs/type-byte-buffer.md
)) - Fixed a missing `stdint.h` include - Fixed parser limiter for recursive type annotations being kind of weird (fixes #645) ### Native Codegen - Fixed a pair of issues when lowering `bit32.extract` - Fixed a narrow edge case that could result in an infinite loop without an interruption - Fixed a negative array out-of-bounds access issue - Temporarily reverted linear block predecessor value propagation ### New type solver - We now type check assignments to annotated variables - Fixed some test cases under local type inference - Moved `isPending` checks for type families to improve performance - Optimized our process for testing if a free type is sufficiently solved - Removed "none ptr" from lea instruction disassembly logging ### Build system & tooling - CMake configuration now validates dependencies to maintain separation between components - Improvements to the fuzzer coverage - Deduplicator for fuzzed callstacks --------- Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: Vighnesh Vijay <vvijay@roblox.com>
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
#include "Luau/Constraint.h"
|
|
#include "Luau/VisitType.h"
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
Constraint::Constraint(NotNull<Scope> scope, const Location& location, ConstraintV&& c)
|
|
: scope(scope)
|
|
, location(location)
|
|
, c(std::move(c))
|
|
{
|
|
}
|
|
|
|
struct FreeTypeCollector : TypeOnceVisitor
|
|
{
|
|
|
|
DenseHashSet<TypeId>* result;
|
|
|
|
FreeTypeCollector(DenseHashSet<TypeId>* result)
|
|
: result(result)
|
|
{
|
|
}
|
|
|
|
bool visit(TypeId ty, const FreeType&) override
|
|
{
|
|
result->insert(ty);
|
|
return false;
|
|
}
|
|
};
|
|
|
|
DenseHashSet<TypeId> Constraint::getFreeTypes() const
|
|
{
|
|
DenseHashSet<TypeId> types{{}};
|
|
FreeTypeCollector ftc{&types};
|
|
|
|
if (auto sc = get<SubtypeConstraint>(*this))
|
|
{
|
|
ftc.traverse(sc->subType);
|
|
ftc.traverse(sc->superType);
|
|
}
|
|
else if (auto psc = get<PackSubtypeConstraint>(*this))
|
|
{
|
|
ftc.traverse(psc->subPack);
|
|
ftc.traverse(psc->superPack);
|
|
}
|
|
|
|
return types;
|
|
}
|
|
|
|
} // namespace Luau
|