-
Notifications
You must be signed in to change notification settings - Fork 151
interface can extend itself and other possible oddities. #1110
Copy link
Copy link
Open
Description
The following code compiles:
local record Bar
interface Foo
is Foo
end
endThe other oddities, these are either extension of bugs or possibly features so not sure if they should get separate issues or not:
Interface with __call metamethod can be called. (extension of #930 ? Thought there was a similar issue specifically for interfaces but couldn't find it.)
local record Bar
interface Foo
metamethod __call: function(_:self)
end
end
Bar.Foo() --allowedI personally don't mind this one as much if there was a way to actually safely provide this method to be called. Sadly, right now the only way to do so requires sidestepping teal. Thus losing the benefits of static types.
Types can extend generics.
local record Boo
interface Foo<T>
is T
end
interface Bar end
end
local function bar(_ : Boo.Bar) end
local a : Boo.Foo<Boo.Bar> = {}
bar(a) --compilesI think you can do some cool stuff with this? However if you change Bar from an interface to a Record then it will only fail to compile at the function call, stating that Foo is not a Bar.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels