]> Cypherpunks.ru repositories - gostls13.git/commitdiff
go/types, types2: re-enable panic if unification stack-overflows
authorRobert Griesemer <gri@golang.org>
Mon, 14 Mar 2022 20:26:42 +0000 (13:26 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 21 Mar 2022 19:10:16 +0000 (19:10 +0000)
With all the unification/type-inference fixes in place now, we
should not see stack overflows anymore. Re-enable the panic if
we do overflow, so we can address those issues should they arise.

Fixes #51377.

Change-Id: Ied64435ea5936811504cb30bda1126c7d85980f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/392755
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/unify.go
src/go/types/unify.go

index 97d327cf8b07ededf8d60ebbf1c9c2139ccd4eb9..a7f68a05b1d2878443a67671704f8028f0c941de 100644 (file)
@@ -39,9 +39,10 @@ const (
        // due to implementation issues (e.g., see issues #48619, #48656).
        unificationDepthLimit = 50
 
-       // Whether to panic when unificationDepthLimit is reached. Turn on when
-       // investigating infinite recursion.
-       panicAtUnificationDepthLimit = false
+       // Whether to panic when unificationDepthLimit is reached.
+       // If disabled, a recursion depth overflow results in a (quiet)
+       // unification failure.
+       panicAtUnificationDepthLimit = true
 
        // If enableCoreTypeUnification is set, unification will consider
        // the core types, if any, of non-local (unbound) type parameters.
index 7b9aeeee0aea0f48ed12863e27d5dbe3219b7b55..0742e40d8bd9d23db34efe547d9318f8c40a5f7a 100644 (file)
@@ -39,9 +39,10 @@ const (
        // due to implementation issues (e.g., see issues #48619, #48656).
        unificationDepthLimit = 50
 
-       // Whether to panic when unificationDepthLimit is reached. Turn on when
-       // investigating infinite recursion.
-       panicAtUnificationDepthLimit = false
+       // Whether to panic when unificationDepthLimit is reached.
+       // If disabled, a recursion depth overflow results in a (quiet)
+       // unification failure.
+       panicAtUnificationDepthLimit = true
 
        // If enableCoreTypeUnification is set, unification will consider
        // the core types, if any, of non-local (unbound) type parameters.