mirror of https://github.com/golang/go.git
[dev.go2go] go/types: fix type check skipping for constraints when there’s more than one generic constraint.
Fixes #39754.
This commit is contained in:
parent
4dfbf5ab9c
commit
bf418db782
|
|
@ -130,6 +130,7 @@ var tests = [][]string{
|
|||
{"fixedbugs/issue39680.go2"},
|
||||
{"fixedbugs/issue39711.go2"},
|
||||
{"fixedbugs/issue39723.go2"},
|
||||
{"fixedbugs/issue39754.go2"},
|
||||
{"fixedbugs/issue39755.go2"},
|
||||
{"fixedbugs/issue39768.go2"},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2020 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
type Optional(type T) struct {
|
||||
p T
|
||||
set bool
|
||||
}
|
||||
|
||||
func (o Optional(T)) Val() (T, bool) {
|
||||
return o.p, true
|
||||
}
|
||||
|
||||
type Box(type T) interface {
|
||||
Val() (T, bool)
|
||||
}
|
||||
|
||||
func F1(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)" */)()
|
||||
}
|
||||
|
|
@ -177,7 +177,7 @@ func (check *Checker) instantiate(pos token.Pos, typ Type, targs []Type, poslist
|
|||
|
||||
// targ's underlying type must also be one of the interface types listed, if any
|
||||
if iface.allTypes == nil {
|
||||
break // nothing to do
|
||||
continue // nothing to do
|
||||
}
|
||||
// iface.allTypes != nil
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue