@@ -374,10 +374,11 @@ function vm.isSubType(uri, child, parent, mark, errs)
374
374
elseif child .type == ' vm.node' then
375
375
if config .get (uri , ' Lua.type.weakUnionCheck' ) then
376
376
local hasKnownType = 0
377
+ local maxUnionVariants = config .get (uri , ' Lua.type.maxUnionVariants' ) or 0
377
378
local i = 0
378
379
for n in child :eachObject () do
379
380
i = i + 1
380
- if i > 100 then
381
+ if maxUnionVariants > 0 and i > maxUnionVariants then
381
382
break
382
383
end
383
384
if vm .getNodeName (n ) then
@@ -403,10 +404,11 @@ function vm.isSubType(uri, child, parent, mark, errs)
403
404
else
404
405
local weakNil = config .get (uri , ' Lua.type.weakNilCheck' )
405
406
local skipTable
407
+ local maxUnionVariants = config .get (uri , ' Lua.type.maxUnionVariants' ) or 0
406
408
local i = 0
407
409
for n in child :eachObject () do
408
410
i = i + 1
409
- if i > 100 then
411
+ if maxUnionVariants > 0 and i > maxUnionVariants then
410
412
break
411
413
end
412
414
if skipTable == nil and n .type == " table" and parent .type == " vm.node" then -- skip table type check if child has class
@@ -473,10 +475,11 @@ function vm.isSubType(uri, child, parent, mark, errs)
473
475
parent = global
474
476
elseif parent .type == ' vm.node' then
475
477
local hasKnownType = 0
478
+ local maxUnionVariants = config .get (uri , ' Lua.type.maxUnionVariants' ) or 0
476
479
local i = 0
477
480
for n in parent :eachObject () do
478
481
i = i + 1
479
- if i > 100 then
482
+ if maxUnionVariants > 0 and i > maxUnionVariants then
480
483
break
481
484
end
482
485
if vm .getNodeName (n ) then
0 commit comments