File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -727,6 +727,14 @@ func (r *runner) getFunction(instr ssa.Instruction) (f *ssa.Function) {
727
727
}
728
728
729
729
func (r * runner ) isCtxType (tp types.Type ) bool {
730
+ if p , ok := tp .(* types.Pointer ); ok {
731
+ // opaqueType is not exposed and lead to unreachable error.
732
+ // Related to https://github.com/golang/tools/blob/63229bc79404d8cf2fe4e88ad569168fe251d993/go/ssa/builder.go#L107
733
+ if p .Elem ().String () == "deferStack" {
734
+ return false
735
+ }
736
+ }
737
+
730
738
return types .Identical (tp , r .ctxTyp ) || types .Identical (tp , r .ctxPTyp )
731
739
}
732
740
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package a // want package:"ctxCheck"
3
3
import (
4
4
"context"
5
5
"net/http"
6
+ "slices"
6
7
)
7
8
8
9
type MyString string
@@ -171,3 +172,13 @@ func f17(ctx context.Context, k string) func() func() {
171
172
}
172
173
}
173
174
}
175
+
176
+ /* ----------------- range over iter.Seq ----------------- */
177
+
178
+ func fIterSeq () {
179
+ seq := slices .Values ([]any {"a" })
180
+ for range seq {
181
+ _ , cancel := context .WithCancel (context .Background ())
182
+ defer cancel ()
183
+ }
184
+ }
You can’t perform that action at this time.
0 commit comments