File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ function mt:setTruthy()
131131 for index = # self , 1 , - 1 do
132132 local c = self [index ]
133133 if c .type == ' nil'
134+ or (c .type == ' global' and c .cate == ' type' and c .name == ' nil' )
134135 or (c .type == ' boolean' and c [1 ] == false )
135136 or (c .type == ' doc.type.boolean' and c [1 ] == false ) then
136137 table.remove (self , index )
@@ -163,6 +164,7 @@ function mt:setFalsy()
163164 for index = # self , 1 , - 1 do
164165 local c = self [index ]
165166 if c .type == ' nil'
167+ or (c .type == ' global' and c .cate == ' type' and c .name == ' nil' )
166168 or (c .type == ' boolean' and c [1 ] == true )
167169 or (c .type == ' doc.type.boolean' and c [1 ] == true ) then
168170 goto CONTINUE
Original file line number Diff line number Diff line change @@ -1979,6 +1979,24 @@ assert(x ~= nil)
19791979print(<?x?>)
19801980]]
19811981
1982+ TEST ' integer' [[
1983+ ---@type integer | nil
1984+ local x
1985+
1986+ assert(x)
1987+
1988+ print(<?x?>)
1989+ ]]
1990+
1991+ TEST ' integer' [[
1992+ ---@type integer | nil
1993+ local x
1994+
1995+ assert(x ~= nil)
1996+
1997+ print(<?x?>)
1998+ ]]
1999+
19822000TEST ' integer' [[
19832001local x
19842002
You can’t perform that action at this time.
0 commit comments