]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: terminate compilation if type-checking fails
authorRobert Griesemer <gri@golang.org>
Tue, 5 Jun 2018 17:19:03 +0000 (10:19 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 6 Jun 2018 00:15:51 +0000 (00:15 +0000)
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>
src/cmd/compile/internal/gc/main.go

index e9d9e5566e6efcedabfddda49950c4854e0ca465..e8b33008b45751a4e99663d4201b64544d73233f 100644 (file)
@@ -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.