Merge pull request 'Fix new compiler error from Teal 0.15.0 upgrade' (#75) from feat/fixes-teal-0.15.0 into master
ci/woodpecker/push/build Pipeline was successful Details
ci/woodpecker/push/docker-build Pipeline was successful Details
ci/woodpecker/push/lint Pipeline was successful Details

Reviewed-on: #75
This commit is contained in:
Aire-One 2023-02-04 00:23:02 +01:00
commit 5cd9a539a5
4 changed files with 6 additions and 8 deletions

View File

@ -18,7 +18,7 @@ local record Function_Info
parameters: List<Variable_Info.Variable_Info>
return_types: List<Type_Info.Type_Info>
append_parameter: function(self: Function_Info, name: string, type: string)
append_parameter: function(self: Function_Info, name: string, types: List<Type_Info.Type_Info>)
append_return_type: function(self: Function_Info, return_type: string)
fixup: function(Function_Info)

View File

@ -16,11 +16,9 @@ end
local __Variable_Info: metatable<Variable_Info> = {
__call = function(_self: Variable_Info, name: string | nil, types: List<Type_Info.Type_Info> | nil): Variable_Info
name = name or ""
types = types or List()
return {
name = name,
types = types,
name = name or "",
types = types or List(),
fixup = function(self: Variable_Info)
for t in self.types:iter() do

View File

@ -30,7 +30,7 @@ end
function snippets.render_requires(requires: Map<string, string>): string
local tmpl = [[local $(name) = require "$(path)"]]
local require_statements <const> = List()
local require_statements <const>: List<string> = List()
for name, path in requires:iter() do
local tmpl_args = {
name = name,

View File

@ -58,12 +58,12 @@ function utils.do_or_fail<T>(func: function<T>(...: any): (T | nil, string), ...
local ok, res, err = pcall(func, ...)
if not (ok and res) then
if not ok then
log:error(logger.message_with_metadata("do_or_fail failed!", { error = err }))
error(err)
end
return res
return res as T -- promote to T since pcall succeeded at this point
end
return utils