luau/tests/conformance/tmerror.lua
Andy Friesen e25b0a6275
Sync to upstream/release/591 (#1012)
* Fix a use-after-free bug in the new type cloning algorithm
* Tighten up the type of `coroutine.wrap`. It is now `<A..., R...>(f:
(A...) -> R...) -> ((A...) -> R...)`
* Break `.luaurc` out into a separate library target `Luau.Config`. This
makes it easier for applications to reason about config files without
also depending on the type inference engine.
* Move typechecking limits into `FrontendOptions`. This allows embedders
more finely-grained control over autocomplete's internal time limits.
* Fix stability issue with debugger onprotectederror callback allowing
break in non-yieldable contexts

New solver:

* Initial work toward [Local Type
Inference](0e1082108f/rfcs/local-type-inference.md)
* Introduce a new subtyping test. This will be much nicer than the old
test because it is completely separate both from actual type inference
and from error reporting.

Native code generation:

* Added function to compute iterated dominance frontier
* Optimize barriers in SET_UPVALUE when tag is known
* Cache lua_State::global in a register on A64
* Optimize constant stores in A64 lowering
* Track table array size state to optimize array size checks
* Add split tag/value store into a VM register
* Check that spills can outlive the block only in specific conditions

---------

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2023-08-18 11:15:41 -07:00

41 lines
1.1 KiB
Lua

-- This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
-- This file is based on Lua 5.x tests -- https://github.com/lua/lua/tree/master/testes
-- Generate an error (i.e. throw an exception) inside a tag method which is indirectly
-- called via pcall.
-- This test is meant to detect a regression in handling errors inside a tag method
local testtable = {}
setmetatable(testtable, { __index = function() error("Error") end })
pcall(function()
testtable.missingmethod()
end)
--
local testtable2 = {}
setmetatable(testtable2, { __index = function() pcall(function() error("Error") end) end })
local m2 = testtable2.missingmethod
pcall(function()
testtable2.missingmethod()
end)
--
local testtable3 = {}
setmetatable(testtable3, { __index = function() pcall(error, "Error") end })
local m3 = testtable3.missingmethod
pcall(function()
testtable3.missingmethod()
end)
--
local testtable4 = {}
setmetatable(testtable4, { __index = function() pcall(error) end })
local m4 = testtable4.missingmember
return('OK')