From fa7d11a0e9c0ed469111ba5fdd86f7462a48ef49 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Sat, 16 Oct 2021 14:54:42 -0700 Subject: [PATCH] go/types, types2: add test case for missing return The respective issue was fixed in types2 with CL 356189; and the problem didn't exist in go/types. This CL simply adds the test case to the type checkers as well. For #49003. Change-Id: Ib50ee8bb0ad21f2916f2b79d4f77593302899a3e Reviewed-on: https://go-review.googlesource.com/c/go/+/356411 Trust: Robert Griesemer Run-TryBot: Robert Griesemer TryBot-Result: Go Bot Reviewed-by: Cuong Manh Le --- .../internal/types2/testdata/fixedbugs/issue49003.go | 10 ++++++++++ src/go/types/testdata/fixedbugs/issue49003.go | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/cmd/compile/internal/types2/testdata/fixedbugs/issue49003.go create mode 100644 src/go/types/testdata/fixedbugs/issue49003.go diff --git a/src/cmd/compile/internal/types2/testdata/fixedbugs/issue49003.go b/src/cmd/compile/internal/types2/testdata/fixedbugs/issue49003.go new file mode 100644 index 00000000000..ece1a27bb92 --- /dev/null +++ b/src/cmd/compile/internal/types2/testdata/fixedbugs/issue49003.go @@ -0,0 +1,10 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package p + +func f(s string) int { + for range s { + } +} // ERROR missing return diff --git a/src/go/types/testdata/fixedbugs/issue49003.go b/src/go/types/testdata/fixedbugs/issue49003.go new file mode 100644 index 00000000000..ece1a27bb92 --- /dev/null +++ b/src/go/types/testdata/fixedbugs/issue49003.go @@ -0,0 +1,10 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package p + +func f(s string) int { + for range s { + } +} // ERROR missing return