mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 06:15:44 +08:00
ce8495a69e
# What's Changed? - Code refactoring with a new clang-format - More bug fixes / test case fixes in the new solver ## New Solver - More precise telemetry collection of `any` types - Simplification of two completely disjoint tables combines them into a single table that inherits all properties / indexers - Refining a `never & <anything>` does not produce type family types nor constraints - Silence "inference failed to complete" error when it is the only error reported --- ### Internal Contributors Co-authored-by: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: Dibri Nsofor <dnsofor@roblox.com> Co-authored-by: Jeremy Yoo <jyoo@roblox.com> Co-authored-by: Vighnesh Vijay <vvijay@roblox.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com> --------- Co-authored-by: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: Alexander McCord <amccord@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: Vighnesh <vvijay@roblox.com> Co-authored-by: Aviral Goel <agoel@roblox.com> Co-authored-by: David Cope <dcope@roblox.com> Co-authored-by: Lily Brown <lbrown@roblox.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
50 lines
1.7 KiB
C++
50 lines
1.7 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#include "Luau/BuiltinDefinitions.h"
|
|
#include "Luau/Type.h"
|
|
|
|
#include "Fixture.h"
|
|
|
|
#include "doctest.h"
|
|
|
|
using namespace Luau;
|
|
|
|
TEST_SUITE_BEGIN("BuiltinDefinitionsTest");
|
|
|
|
TEST_CASE_FIXTURE(BuiltinsFixture, "lib_documentation_symbols")
|
|
{
|
|
CHECK(!frontend.globals.globalScope->bindings.empty());
|
|
|
|
for (const auto& [name, binding] : frontend.globals.globalScope->bindings)
|
|
{
|
|
std::string nameString(name.c_str());
|
|
std::string expectedRootSymbol = "@luau/global/" + nameString;
|
|
std::optional<std::string> actualRootSymbol = binding.documentationSymbol;
|
|
CHECK_MESSAGE(
|
|
actualRootSymbol == expectedRootSymbol, "expected symbol ", expectedRootSymbol, " for global ", nameString, ", got ", actualRootSymbol
|
|
);
|
|
|
|
const TableType::Props* props = nullptr;
|
|
if (const TableType* ttv = get<TableType>(binding.typeId))
|
|
{
|
|
props = &ttv->props;
|
|
}
|
|
else if (const ClassType* ctv = get<ClassType>(binding.typeId))
|
|
{
|
|
props = &ctv->props;
|
|
}
|
|
|
|
if (props)
|
|
{
|
|
for (const auto& [propName, prop] : *props)
|
|
{
|
|
std::string fullPropName = nameString + "." + propName;
|
|
std::string expectedPropSymbol = expectedRootSymbol + "." + propName;
|
|
std::optional<std::string> actualPropSymbol = prop.documentationSymbol;
|
|
CHECK_MESSAGE(
|
|
actualPropSymbol == expectedPropSymbol, "expected symbol ", expectedPropSymbol, " for ", fullPropName, ", got ", actualPropSymbol
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|