mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile/internal/syntax: accept embedded type literals
The parser accepted embedded elements but the first term of an element had to be a ~-term or a type name. This CL fixes that. Change-Id: I013b6cdc5963fb228867ca6597f9139db2be7ec5 Reviewed-on: https://go-review.googlesource.com/c/go/+/321109 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
f3fc8b5779
commit
81b22480cf
2 changed files with 57 additions and 1 deletions
|
|
@ -1443,6 +1443,18 @@ func (p *parser) interfaceType() *InterfaceType {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
default:
|
||||
if p.mode&AllowGenerics != 0 {
|
||||
pos := p.pos()
|
||||
if t := p.typeOrNil(); t != nil {
|
||||
f := new(Field)
|
||||
f.pos = pos
|
||||
f.Type = t
|
||||
typ.MethodList = append(typ.MethodList, p.embeddedElem(f))
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if p.mode&AllowGenerics != 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue