More param names

This commit is contained in:
JohnnyMorganz 2022-07-23 14:57:21 +01:00
parent ae4632a386
commit 7bce339d4f
3 changed files with 9 additions and 9 deletions

View file

@ -221,7 +221,7 @@ void registerBuiltinTypes(TypeChecker& typeChecker)
TypeId tableMetaMT = arena.addType(MetatableTypeVar{tabTy, genericMT});
addGlobalBinding(typeChecker, "getmetatable", makeFunction(arena, std::nullopt, {genericMT}, {}, {tableMetaMT}, {genericMT}), "@luau");
addGlobalBinding(typeChecker, "getmetatable", makeFunction(arena, std::nullopt, {genericMT}, {}, {tableMetaMT}, {"tbl"}, {genericMT}), "@luau");
// clang-format off
// setmetatable<T: {}, MT>(T, MT) -> { @metatable MT, T }

View file

@ -170,7 +170,7 @@ declare table: {
getn: <V>(tbl: {V}) -> number,
foreach: <K, V>(tbl: {[K]: V}, f: (key: K, value: V) -> ()) -> (),
foreachi: <V>(tbl: {V}, (index: number, value: V) -> ()) -> (),
foreachi: <V>(tbl: {V}, f: (index: number, value: V) -> ()) -> (),
move: <V>(tbl: {V}, from: number, to: number, startIndex: number, newTbl: {V}?) -> {V},
clear: <K, V>(tbl: {[K]: V}) -> (),

View file

@ -766,14 +766,14 @@ TypeId SingletonTypes::makeStringMetatable()
const TypePackId stringVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{stringType}});
const TypePackId numberVariadicList = arena->addTypePack(TypePackVar{VariadicTypePack{numberType}});
const TypeId stringToStringType = makeFunction(*arena, std::nullopt, {}, {}, {stringType}, {}, {stringType});
const TypeId stringToStringType = makeFunction(*arena, std::nullopt, {}, {}, {stringType}, {"str"}, {stringType});
const TypeId replArgType = arena->addType(
UnionTypeVar{{stringType, arena->addType(TableTypeVar({}, TableIndexer(stringType, stringType), TypeLevel{}, TableState::Generic)),
makeFunction(*arena, std::nullopt, {}, {}, {stringType}, {}, {stringType})}});
const TypeId gsubFunc = makeFunction(*arena, stringType, {}, {}, {stringType, replArgType, optionalNumber}, {}, {stringType, numberType});
const TypeId gsubFunc = makeFunction(*arena, stringType, {}, {}, {stringType, replArgType, optionalNumber}, {"pattern", "replace", "maxs"}, {stringType, numberType});
const TypeId gmatchFunc =
makeFunction(*arena, stringType, {}, {}, {stringType}, {}, {arena->addType(FunctionTypeVar{emptyPack, stringVariadicList})});
makeFunction(*arena, stringType, {}, {}, {stringType}, {"pattern"}, {arena->addType(FunctionTypeVar{emptyPack, stringVariadicList})});
attachMagicFunction(gmatchFunc, magicFunctionGmatch);
const TypeId matchFunc = arena->addType(FunctionTypeVar{arena->addTypePack({stringType, stringType, optionalNumber}),
@ -794,17 +794,17 @@ TypeId SingletonTypes::makeStringMetatable()
{"len", {makeFunction(*arena, stringType, {}, {}, {}, {}, {numberType})}},
{"lower", {stringToStringType}},
{"match", {matchFunc}},
{"rep", {makeFunction(*arena, stringType, {}, {}, {numberType}, {}, {stringType})}},
{"rep", {makeFunction(*arena, stringType, {}, {}, {numberType}, {"n"}, {stringType})}},
{"reverse", {stringToStringType}},
{"sub", {makeFunction(*arena, stringType, {}, {}, {numberType, optionalNumber}, {}, {stringType})}},
{"sub", {makeFunction(*arena, stringType, {}, {}, {numberType, optionalNumber}, {"from", "to"}, {stringType})}},
{"upper", {stringToStringType}},
{"split", {makeFunction(*arena, stringType, {}, {}, {optionalString}, {},
{"split", {makeFunction(*arena, stringType, {}, {}, {optionalString}, {"sep"},
{arena->addType(TableTypeVar{{}, TableIndexer{numberType, stringType}, TypeLevel{}, TableState::Sealed})})}},
{"pack", {arena->addType(FunctionTypeVar{
arena->addTypePack(TypePack{{stringType}, anyTypePack}),
oneStringPack,
})}},
{"packsize", {makeFunction(*arena, stringType, {}, {}, {}, {}, {numberType})}},
{"packsize", {makeFunction(*arena, stringType, {}, {}, {}, {"format"}, {numberType})}},
{"unpack", {arena->addType(FunctionTypeVar{
arena->addTypePack(TypePack{{stringType, stringType, optionalNumber}}),
anyTypePack,