-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync to upstream/release/591 (#1012)
* Fix a use-after-free bug in the new type cloning algorithm * Tighten up the type of `coroutine.wrap`. It is now `<A..., R...>(f: (A...) -> R...) -> ((A...) -> R...)` * Break `.luaurc` out into a separate library target `Luau.Config`. This makes it easier for applications to reason about config files without also depending on the type inference engine. * Move typechecking limits into `FrontendOptions`. This allows embedders more finely-grained control over autocomplete's internal time limits. * Fix stability issue with debugger onprotectederror callback allowing break in non-yieldable contexts New solver: * Initial work toward [Local Type Inference](https://github.com/Roblox/luau/blob/0e1082108fd6fb3a32dfdf5f1766ea3fc1391328/rfcs/local-type-inference.md) * Introduce a new subtyping test. This will be much nicer than the old test because it is completely separate both from actual type inference and from error reporting. Native code generation: * Added function to compute iterated dominance frontier * Optimize barriers in SET_UPVALUE when tag is known * Cache lua_State::global in a register on A64 * Optimize constant stores in A64 lowering * Track table array size state to optimize array size checks * Add split tag/value store into a VM register * Check that spills can outlive the block only in specific conditions --------- Co-authored-by: Arseny Kapoulkine <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]>
- Loading branch information
1 parent
a2a4710
commit e25b0a6
Showing
63 changed files
with
1,977 additions
and
425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details | ||
#pragma once | ||
|
||
#include "Luau/Type.h" | ||
|
||
#include <vector> | ||
#include <optional> | ||
|
||
namespace Luau | ||
{ | ||
|
||
template<typename A, typename B> | ||
struct TryPair; | ||
|
||
class Normalizer; | ||
struct NormalizedType; | ||
|
||
struct SubtypingGraph | ||
{ | ||
// Did the test succeed? | ||
bool isSubtype = false; | ||
bool isErrorSuppressing = false; | ||
bool normalizationTooComplex = false; | ||
|
||
// If so, what constraints are implied by this relation? | ||
// If not, what happened? | ||
|
||
SubtypingGraph and_(const SubtypingGraph& other); | ||
SubtypingGraph or_(const SubtypingGraph& other); | ||
|
||
static SubtypingGraph and_(const std::vector<SubtypingGraph>& results); | ||
static SubtypingGraph or_(const std::vector<SubtypingGraph>& results); | ||
}; | ||
|
||
struct Subtyping | ||
{ | ||
NotNull<BuiltinTypes> builtinTypes; | ||
NotNull<Normalizer> normalizer; | ||
|
||
// TODO cache | ||
// TODO cyclic types | ||
// TODO recursion limits | ||
|
||
SubtypingGraph isSubtype(TypeId subTy, TypeId superTy); | ||
SubtypingGraph isSubtype(TypePackId subTy, TypePackId superTy); | ||
|
||
private: | ||
template<typename SubTy, typename SuperTy> | ||
SubtypingGraph isSubtype(const TryPair<const SubTy*, const SuperTy*>& pair); | ||
|
||
SubtypingGraph isSubtype(TypeId subTy, const UnionType* superUnion); | ||
SubtypingGraph isSubtype(const UnionType* subUnion, TypeId superTy); | ||
SubtypingGraph isSubtype(TypeId subTy, const IntersectionType* superIntersection); | ||
SubtypingGraph isSubtype(const IntersectionType* subIntersection, TypeId superTy); | ||
SubtypingGraph isSubtype(const PrimitiveType* subPrim, const PrimitiveType* superPrim); | ||
SubtypingGraph isSubtype(const SingletonType* subSingleton, const PrimitiveType* superPrim); | ||
SubtypingGraph isSubtype(const SingletonType* subSingleton, const SingletonType* superSingleton); | ||
SubtypingGraph isSubtype(const FunctionType* subFunction, const FunctionType* superFunction); | ||
|
||
SubtypingGraph isSubtype(const NormalizedType* subNorm, const NormalizedType* superNorm); | ||
}; | ||
|
||
} // namespace Luau |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.