]> Cypherpunks repositories - gostls13.git/commitdiff
go/types, types2: remove misleading example from comment
authorRobert Griesemer <gri@golang.org>
Thu, 26 Jan 2023 19:22:26 +0000 (11:22 -0800)
committerGopher Robot <gobot@golang.org>
Thu, 26 Jan 2023 19:45:22 +0000 (19:45 +0000)
Before this CL, the comment used the case of a recursive generic
function call as an example for uni-directional unification.
However, such cases are now more generally (and correctly) addressed
through renaming of the type parameters.

Change-Id: I69e94f53418e1fb4ca9431aeb27c639c40d19b09
Reviewed-on: https://go-review.googlesource.com/c/go/+/463735
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/compile/internal/types2/unify.go
src/go/types/unify.go

index 08508c0e60b5b2f2c4d7a12354ff1051ccb17096..381093c57411a55a4c05adefe4a36483e9c6a3ee 100644 (file)
@@ -17,15 +17,7 @@ import (
 // provided to the unify call. For unidirectional unification, only
 // one of these sets (say x) is provided, and then type parameters are
 // only resolved for the x argument passed to unify, not the y argument
-// (even if that also contains possibly the same type parameters). This
-// is crucial to infer the type parameters of self-recursive calls:
-//
-//     func f[P any](a P) { f(a) }
-//
-// For the call f(a) we want to infer that the type argument for P is P.
-// During unification, the parameter type P must be resolved to the type
-// parameter P ("x" side), but the argument type P must be left alone so
-// that unification resolves the type parameter P to P.
+// (even if that also contains possibly the same type parameters).
 //
 // For bidirectional unification, both sets are provided. This enables
 // unification to go from argument to parameter type and vice versa.
index 9fb0c75893ce806c90825aced74df71cc2a9c6fb..206ec69d590f4a7077b58cf40e9837bf30d56af2 100644 (file)
@@ -19,15 +19,7 @@ import (
 // provided to the unify call. For unidirectional unification, only
 // one of these sets (say x) is provided, and then type parameters are
 // only resolved for the x argument passed to unify, not the y argument
-// (even if that also contains possibly the same type parameters). This
-// is crucial to infer the type parameters of self-recursive calls:
-//
-//     func f[P any](a P) { f(a) }
-//
-// For the call f(a) we want to infer that the type argument for P is P.
-// During unification, the parameter type P must be resolved to the type
-// parameter P ("x" side), but the argument type P must be left alone so
-// that unification resolves the type parameter P to P.
+// (even if that also contains possibly the same type parameters).
 //
 // For bidirectional unification, both sets are provided. This enables
 // unification to go from argument to parameter type and vice versa.