We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 95e1ba4 commit 4719a06Copy full SHA for 4719a06
go/ir/sanity.go
@@ -10,6 +10,7 @@ package ir
10
import (
11
"bytes"
12
"fmt"
13
+ "go/ast"
14
"go/types"
15
"io"
16
"os"
@@ -462,7 +463,10 @@ func (s *sanity) checkFunction(fn *Function) bool {
462
463
}
464
465
if syn, src := fn.Synthetic == 0, fn.source != nil; src != syn {
- s.errorf("got fromSource=%t, hasSyntax=%t; want same values", src, syn)
466
+ if _, ok := fn.source.(*ast.RangeStmt); !ok || fn.Synthetic != SyntheticRangeOverFuncYield {
467
+ // Only range-over-func yield functions are synthetic and have syntax
468
+ s.errorf("got fromSource=%t, hasSyntax=%t; want same values", src, syn)
469
+ }
470
471
for i, l := range fn.Locals {
472
if l.Parent() != fn {
0 commit comments