This CL sets enableInterfaceInference to true.
If problems arise due to this during the freeze, revert this CL.
Fixes #41176.
Fixes #57192.
Change-Id: I881ea6842e9c1101b24d9780323c6af365a40d3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/497657
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
// If enableInterfaceInference is set, type inference uses
// shared methods for improved type inference involving
// interfaces.
- enableInterfaceInference = false
+ enableInterfaceInference = true
// If traceInference is set, unification will print a trace of its operation.
// Interpretation of trace:
// If enableInterfaceInference is set, type inference uses
// shared methods for improved type inference involving
// interfaces.
- enableInterfaceInference = false
+ enableInterfaceInference = true
// If traceInference is set, unification will print a trace of its operation.
// Interpretation of trace:
func _() {
var lru LRU[int, string]
NewCache[int, string](&lru)
- NewCache(& /* ERROR "does not match policy[K, V] (cannot infer K and V)" */ lru)
+ NewCache /* ERROR "cannot infer K" */ (&lru)
}
func f[T any](x I[T]) {}
func _() {
- f(S /* ERROR "cannot infer T" */ {})
+ f(S{})
}
func WithLocking2[K comparable, V any](Cache[K, V]) {}
func _() {
- WithLocking2[string](LRU /* ERROR "type LRU[string, int] of LRU[string, int]{} does not match inferred type Cache[string, int] for Cache[string, V]" */ [string, int]{})
+ WithLocking2 /* ERROR "cannot infer V" */ [string](LRU[string, int]{})
}
func g[T any](I1[T]) {}
func _() {
g(V1)
- g(V2 /* ERROR "type I2[int] of V2 does not match inferred type I1[int] for I1[T]" */)
+ g(V2)
}