-
-
Notifications
You must be signed in to change notification settings - Fork 386
Closed
Labels
enhancementNew feature or requestNew feature or requestfeat/type checkRelated to the type checking featureRelated to the type checking feature
Milestone
Description
I've been looking to add more python style function calls where you can mix both have positional arguments and keyword arguments.
It almost works already 😄 except type checking is not done for positional arguments in the caller. Inside the function it works well.
---@param args {a: integer, b: integer|nil, test: string}
local function test_no_pos(args)
-- these are correctly typed
local a = args.a
local b = args.b
end
-- everything works correctly
test_no_pos {a = "23", b = "2", test = "string"} -- correctly errors on a,b
test_no_pos({a = "23", b = "2", test = "string"}) -- correctly errors on a,b
---@param args {[1]: integer, [2]: integer|nil, test: string}
local function test_pos(args)
-- these are also correctly typed
local a = args[1]
local b = args[2]
end
test_pos {"23", "2", test = "string"} -- does not error
test_pos({"23", "2", test = "string"}) -- does not errorMetadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfeat/type checkRelated to the type checking featureRelated to the type checking feature