teal-language / tl

The compiler for Teal, a typed dialect of Lua
MIT License
2.04k stars 101 forks source link

Fix returning record with type alias issue #586

Closed pigpigyyy closed 1 year ago

pigpigyyy commented 1 year ago

The problem appeared after recent commit. Minimal reproducing codes are:

-- file: mod.tl
local record R
   n: number
end
local record Mod
   type T = R
end
local inst: Mod
return inst

-- file: merged.tl
local mod = require("mod")
return {
   mod = mod
}

-- file: foo.tl
local merged = require("merged")
local t: merged.mod.T
print(t.n)

Tried fixing it, if there is better way of fixing, this PR can be just dropped.

github-actions[bot] commented 1 year ago

Teal Playground URL: https://586--teal-playground-preview.netlify.app

hishamhm commented 1 year ago

@pigpigyyy Merged manually, thank you!