@@ -23,18 +23,32 @@ local function isBooleanOnly(infer, uri)
2323 if infer :hasAny (uri ) or infer :hasUnknown (uri ) then
2424 return nil
2525 end
26- local hasBoolean = infer :hasType (uri , ' boolean' )
27- if not hasBoolean then
28- return false
29- end
3026 for view in infer :eachView (uri ) do
31- if view ~= ' boolean' then
27+ if view ~= ' boolean'
28+ and view ~= ' true'
29+ and view ~= ' false' then
3230 return false
3331 end
3432 end
3533 return true
3634end
3735
36+ --- @param source parser.object ?
37+ --- @return boolean
38+ local function isConditionFilter (source )
39+ if not source or not source .parent then
40+ return false
41+ end
42+ local parent = source .parent
43+ if parent .type ~= ' ifblock'
44+ and parent .type ~= ' elseifblock'
45+ and parent .type ~= ' while'
46+ and parent .type ~= ' repeat' then
47+ return false
48+ end
49+ return parent .filter == source
50+ end
51+
3852--- @param source parser.object ?
3953--- @param uri uri
4054--- @param callback fun ( result : diag.result )
@@ -90,6 +104,11 @@ return function (uri, callback)
90104 if op ~= ' and' and op ~= ' or' then
91105 return
92106 end
107+ if isConditionFilter (source ) then
108+ checkExpression (source [1 ], uri , callback )
109+ checkExpression (source [2 ], uri , callback )
110+ return
111+ end
93112 checkExpression (source [1 ], uri , callback )
94113 end )
95114end
0 commit comments