Skip to content

Commit 868a110

Browse files
committed
cmd/compile: make check2 gracefully exit if it reported errors
Otherwise, if -d=panic was set, check2 will treat already reported error as internal compiler error. For #43311 Fixes #44445 Change-Id: I5dbe06334666df21d9107396b9dcfdd905aa1e44 Reviewed-on: https://go-review.googlesource.com/c/go/+/294850 Trust: Cuong Manh Le <[email protected]> Run-TryBot: Cuong Manh Le <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
1 parent 1d0256a commit 868a110

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/cmd/compile/internal/noder/irgen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ func check2(noders []*noder) {
6868
}
6969
pkg, err := conf.Check(base.Ctxt.Pkgpath, files, &info)
7070
files = nil
71+
base.ExitIfErrors()
7172
if err != nil {
7273
base.FatalfAt(src.NoXPos, "conf.Check error: %v", err)
7374
}
74-
base.ExitIfErrors()
7575
if base.Flag.G < 2 {
7676
os.Exit(0)
7777
}

test/fixedbugs/bug188.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// errorcheck
1+
// errorcheck -d=panic
22

33
// Copyright 2009 The Go Authors. All rights reserved.
44
// Use of this source code is governed by a BSD-style
@@ -9,7 +9,7 @@ package main
99
import "sort"
1010

1111
func main() {
12-
sort.Sort(nil);
13-
var x int;
14-
sort(x); // ERROR "package"
12+
sort.Sort(nil)
13+
var x int
14+
sort(x) // ERROR "package"
1515
}

test/fixedbugs/bug358.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// errorcheck
1+
// errorcheck -d=panic
22

33
// Copyright 2011 The Go Authors. All rights reserved.
44
// Use of this source code is governed by a BSD-style

test/fixedbugs/bug397.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// errorcheck
1+
// errorcheck -d=panic
22

33
// Copyright 2011 The Go Authors. All rights reserved.
44
// Use of this source code is governed by a BSD-style
@@ -7,7 +7,7 @@
77
package main
88

99
// Issue 2623
10-
var m = map[string]int {
11-
"abc":1,
12-
1:2, // ERROR "cannot use 1.*as type string in map key|incompatible type|cannot convert"
10+
var m = map[string]int{
11+
"abc": 1,
12+
1: 2, // ERROR "cannot use 1.*as type string in map key|incompatible type|cannot convert"
1313
}

0 commit comments

Comments
 (0)