File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
go/analysis/passes/nilness Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ func (n nilness) String() string { return nilnessStrings[n+1] }
245
245
// or unknown given the dominating stack of facts.
246
246
func nilnessOf (stack []fact , v ssa.Value ) nilness {
247
247
switch v := v .(type ) {
248
- // unwrap ChangeInterface values recursively, to detect if underlying
248
+ // unwrap ChangeInterface and Slice values recursively, to detect if underlying
249
249
// values have any facts recorded or are otherwise known with regard to nilness.
250
250
//
251
251
// This work must be in addition to expanding facts about
@@ -259,6 +259,10 @@ func nilnessOf(stack []fact, v ssa.Value) nilness {
259
259
if underlying := nilnessOf (stack , v .X ); underlying != unknown {
260
260
return underlying
261
261
}
262
+ case * ssa.Slice :
263
+ if underlying := nilnessOf (stack , v .X ); underlying != unknown {
264
+ return underlying
265
+ }
262
266
}
263
267
264
268
// Is value intrinsically nil or non-nil?
@@ -275,12 +279,6 @@ func nilnessOf(stack []fact, v ssa.Value) nilness {
275
279
* ssa.MakeMap ,
276
280
* ssa.MakeSlice :
277
281
return isnonnil
278
- case * ssa.Slice :
279
- // unwrap Slice values recursively, to detect if underlying
280
- // values have any facts recorded or are otherwise known with regard to nilness.
281
- if underlying := nilnessOf (stack , v .X ); underlying != unknown {
282
- return underlying
283
- }
284
282
case * ssa.Const :
285
283
if v .IsNil () {
286
284
return isnil
You can’t perform that action at this time.
0 commit comments