-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: using interface in map as function parameter fails to compile #914
Comments
local interface A
end
local record B is A
end
local c: B
local d: {B}
local function Test_1(a: A)
end
local function Test_2(a: {A})
end
Test_1(c) -- Compiles fine
Test_2(d) -- Compiles fine And it seems not bugged for all types. For example, if nested in array, both compile without error. |
local interface A
end
local record C is A
end
local c: C
local function Test(a: {string: A})
end
Test(c) --- Compiles fine. Why? And as I kept testing, more weird stuff happened... I have no idea why this is valid. |
Can you test it with the branch from PR #911 ? thank you! |
Sorry, the test case I presented above is misleading, this is actually nothing to do with generic. Seems using interface in map just causes problem. local interface A
end
local record B is A
end
local c: B
local d: {string: B}
local function Test_1(a: A)
end
local function Test_2(a: {string: A})
end
Test_1(c) -- Compiles fine
Test_2(d) -- Error: argument 1: in map value: B is not a A |
Seems using interface in map just causes compiler error:
If changed map to array, both compile fine:
Desired behavior:
Test_2
compiles without error.The text was updated successfully, but these errors were encountered: