Skip to content

Commit

Permalink
tests: add regression test for #752.
Browse files Browse the repository at this point in the history
Thanks @svermeulen for the report!
  • Loading branch information
hishamhm committed Aug 21, 2024
1 parent 31d21a8 commit 3b03402
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/declaration/local_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,22 @@ describe("local", function()
{ tag = "unused", msg = "unused type integer" },
}))

it("catches bad assignments of record tables (regression test for #752)", util.check_type_error([[
local record Foo
qux: integer
end
local record Bar
gorp: number
end
local _bar1: Bar = 0.0
local _bar2: Bar = Foo
]], {
{ y = 9, msg = "_bar1: got number, expected Bar" },
{ y = 10, msg = "_bar2: Foo is not a Bar" },
}))

it("does not accept type arguments declared twice", util.check_syntax_error([[
local type Foo<T> = record<T>
end
Expand Down

0 comments on commit 3b03402

Please sign in to comment.