mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: add -lang flag to specify language version
The default language version is the current one. For testing purposes, added a check that type aliases require version go1.9. There is no consistent support for changes made before 1.12. Updates #28221 Change-Id: Ia1ef63fff911d5fd29ef79d5fa4e20cfd945feb7 Reviewed-on: https://go-review.googlesource.com/c/144340 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
d1836e629f
commit
2e9f0817f0
5 changed files with 137 additions and 2 deletions
|
|
@ -417,8 +417,11 @@ func (p *noder) typeDecl(decl *syntax.TypeDecl) *Node {
|
|||
param.Pragma = 0
|
||||
}
|
||||
|
||||
return p.nod(decl, ODCLTYPE, n, nil)
|
||||
|
||||
nod := p.nod(decl, ODCLTYPE, n, nil)
|
||||
if param.Alias && !langSupported(1, 9) {
|
||||
yyerrorl(nod.Pos, "type aliases only supported as of -lang=go1.9")
|
||||
}
|
||||
return nod
|
||||
}
|
||||
|
||||
func (p *noder) declNames(names []*syntax.Name) []*Node {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue