From 236ad5a2802478cee910bf64bfadf0a28e57ed99 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 29 Jun 2020 20:45:56 -0700 Subject: [PATCH] [dev.go2go] go/types: fix broken test case While at it, simplified test case a bit. Fixes #39935. Updates #39754. Change-Id: Ia3b51f23807d25e62113757c51a660c7e3a9b381 Reviewed-on: https://go-review.googlesource.com/c/go/+/240478 Reviewed-by: Robert Griesemer --- src/go/types/fixedbugs/issue39754.go2 | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/go/types/fixedbugs/issue39754.go2 b/src/go/types/fixedbugs/issue39754.go2 index 64ce3049ff..ad3dd1fa6e 100644 --- a/src/go/types/fixedbugs/issue39754.go2 +++ b/src/go/types/fixedbugs/issue39754.go2 @@ -2,24 +2,19 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package main +package p -type Optional(type T) struct { - p T - set bool -} +type Optional(type T) struct {} -func (o Optional(T)) Val() (T, bool) { - return o.p, true -} +func (_ Optional(T)) Val() (T, bool) type Box(type T) interface { Val() (T, bool) } -func F1(type V interface{}, A, B Box(V))() {} +func f(type V interface{}, A, B Box(V))() {} -func main() { - F1(int, Optional(int), Optional(int))() - F1(int, Optional(int), Optional(string) /* ERROR "does not satisfy Box(V) (missing method Val)" */)() -} \ No newline at end of file +func _() { + f(int, Optional(int), Optional(int))() + f(int, Optional(int), Optional /* ERROR does not satisfy Box */ (string))() +}