File tree 2 files changed +6
-6
lines changed
src/cmd/compile/internal/typecheck
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -2104,7 +2104,7 @@ func CheckUnused(fn *ir.Func) {
2104
2104
2105
2105
// CheckReturn makes sure that fn terminates appropriately.
2106
2106
func CheckReturn (fn * ir.Func ) {
2107
- if fn .Type ().NumResults () != 0 && len (fn .Body ) != 0 {
2107
+ if fn .Type () != nil && fn . Type () .NumResults () != 0 && len (fn .Body ) != 0 {
2108
2108
markBreak (fn )
2109
2109
if ! isTermNodes (fn .Body ) {
2110
2110
base .ErrorfAt (fn .Endlineno , "missing return at end of function" )
Original file line number Diff line number Diff line change 1
- // errorcheck
1
+ // errorcheck -d=panic
2
2
3
3
// Copyright 2016 The Go Authors. All rights reserved.
4
4
// Use of this source code is governed by a BSD-style
11
11
12
12
package p
13
13
14
- type F func (b T ) // ERROR "T .*is not a type|expected type"
14
+ type F func (b T ) // ERROR "T .*is not a type|expected type"
15
15
16
16
func T (fn F ) {
17
- func () {
18
- fn (nil ) // If Decldepth is not initialized properly, typecheckclosure() Fatals here.
19
- }()
17
+ func () {
18
+ fn (nil ) // If Decldepth is not initialized properly, typecheckclosure() Fatals here.
19
+ }()
20
20
}
You can’t perform that action at this time.
0 commit comments