-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: resolve self correctly in methods
Fixes #812.
- Loading branch information
Showing
3 changed files
with
44 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local util = require("spec.util") | ||
|
||
describe(":", function() | ||
describe("on self", function() | ||
it("can resolve methods (regression test for #812)", util.check([[ | ||
local interface A | ||
get_type: function(A): string | ||
end | ||
local interface B is A where self:get_type() == "b" | ||
end | ||
local b: A = { | ||
get_type = function(): string return "b" end | ||
} | ||
if b is B then | ||
print("woaw") | ||
end | ||
]])) | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters