-
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 nominals at lower scope levels
- Loading branch information
Showing
3 changed files
with
57 additions
and
12 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,39 @@ | ||
local util = require("spec.util") | ||
|
||
describe("nominals", function() | ||
it("references get resolved in the same scope", util.check([[ | ||
-- unresolved nominal reference | ||
local has_unr: function(where: Node) | ||
-- circular type definitions | ||
local type MyFn = function(MyMap) | ||
local type MyMap = {string:MyFn} | ||
-- above nominal reference gets resolved | ||
local record Node | ||
end | ||
has_unr = function(where: Node) | ||
print(where) | ||
end | ||
]])) | ||
|
||
it("references get resolved across scopes", util.check([[ | ||
-- unresolved nominal reference | ||
local has_unr: function(where: Node) | ||
do | ||
-- circular type definitions | ||
local type MyFn = function(MyMap) | ||
local type MyMap = {string:MyFn} | ||
end | ||
-- above nominal reference gets resolved | ||
local record Node | ||
end | ||
has_unr = function(where: Node) | ||
print(where) | ||
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