Skip to content

Commit

Permalink
cmd/compile: terminate compilation if type-checking fails
Browse files Browse the repository at this point in the history
There is no benefit in continuing compilation if there
are type-checking errors. This will increase robustness
of the compiler in the presence of errors.

Fixes #22909.

Change-Id: I1c70c667e5927646ba3d0f370e33705165620f12
Reviewed-on: https://go-review.googlesource.com/116335
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
griesemer committed Jun 6, 2018
1 parent b0951af commit d159d61
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cmd/compile/internal/gc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,10 @@ func Main(archInit func(*Arch)) {
checkMapKeys()
timings.AddEvent(fcount, "funcs")

if nsavederrors+nerrors != 0 {
errorexit()
}

// Phase 4: Decide how to capture closed variables.
// This needs to run before escape analysis,
// because variables captured by value do not escape.
Expand Down

0 comments on commit d159d61

Please sign in to comment.