mirror of
https://github.com/luau-lang/luau.git
synced 2025-03-04 03:01:41 +00:00

## What's new This update brings improvements to the new type solver, roundtrippable AST parsing mode and closes multiple issues reported in this repository. * `require` dependency tracing for non-string requires now supports `()` groups in expressions and types as well as an ability to type annotate a value with a `typeof` of a different module path * Fixed rare misaligned memory access in Compiler/Typechecker on 32 bit platforms (Closes #1572) ## New Solver * Fixed crash/UB in subtyping of type packs (Closes #1449) * Fixed incorrect type errors when calling `debug.info` (Closes #1534 and Resolves #966) * Fixed incorrect boolean and string equality comparison result in user-defined type functions (Closes #1623) * Fixed incorrect class types being produced in user-defined type functions when multiple classes share the same name (Closes #1639) * Improved bidirectional typechecking for table literals containing elements that have not been solved yet (Closes #1641) ## Roundtrippable AST * Added source information for `AstStatTypeAlias` * Fixed an issue with `AstTypeGroup` node (added in #1643) producing invalid AST json. Contained type is now named 'inner' instead of 'type' * Fixed end location of the `do ... end` statement --- Internal Contributors: Co-authored-by: Hunter Goldstein <hgoldstein@roblox.com> Co-authored-by: Talha Pathan <tpathan@roblox.com> Co-authored-by: Varun Saini <vsaini@roblox.com> Co-authored-by: Vighnesh Vijay <vvijay@roblox.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
48 lines
950 B
C++
48 lines
950 B
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#pragma once
|
|
|
|
#include "Luau/Ast.h"
|
|
#include "Luau/Location.h"
|
|
#include "Luau/DenseHash.h"
|
|
#include "Luau/Common.h"
|
|
|
|
#include <vector>
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
class Allocator
|
|
{
|
|
public:
|
|
Allocator();
|
|
Allocator(Allocator&&);
|
|
|
|
Allocator& operator=(Allocator&&) = delete;
|
|
|
|
~Allocator();
|
|
|
|
void* allocate(size_t size);
|
|
|
|
template<typename T, typename... Args>
|
|
T* alloc(Args&&... args)
|
|
{
|
|
static_assert(std::is_trivially_destructible<T>::value, "Objects allocated with this allocator will never have their destructors run!");
|
|
|
|
T* t = static_cast<T*>(allocate(sizeof(T)));
|
|
new (t) T(std::forward<Args>(args)...);
|
|
return t;
|
|
}
|
|
|
|
private:
|
|
struct Page
|
|
{
|
|
Page* next;
|
|
|
|
alignas(8) char data[8192];
|
|
};
|
|
|
|
Page* root;
|
|
size_t offset;
|
|
};
|
|
|
|
} // namespace Luau
|