teal-language / tl

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

Bug: total attribute asks for a type field #647

Closed Andre-LA closed 1 year ago

Andre-LA commented 1 year ago

Example code:

local record Fruit
   name: string
end

local record Person
   record Identity
      name: string
      born: integer
   end

   id: Identity
   likes: Fruit
end

local person <total>: Person = {
   id = {
      name = 'Fulano',
      born = 1995
   },
   likes = {name='orange'}
}

tl check test.tl Output:

[...]
1 error:
teste.tl:15:7: record variable declared <total> does not declare values for all fields (missing: Identity)
hishamhm commented 1 year ago

Thanks for the report and test case!