mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/types2: match compiler error for invalid type alias decl
Fixes #45594. Change-Id: I2fcc784e6908403dd96b009546e1ac2f53b9f0e8 Reviewed-on: https://go-review.googlesource.com/c/go/+/314776 Trust: Robert Griesemer <gri@golang.org> Trust: Dan Scales <danscales@google.com> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
parent
42953bc9f5
commit
6afa0ae4e5
1 changed files with 5 additions and 1 deletions
|
|
@ -602,8 +602,12 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *syntax.TypeDecl, def *Named
|
||||||
if alias {
|
if alias {
|
||||||
// type alias declaration
|
// type alias declaration
|
||||||
if !check.allowVersion(obj.pkg, 1, 9) {
|
if !check.allowVersion(obj.pkg, 1, 9) {
|
||||||
|
if check.conf.CompilerErrorMessages {
|
||||||
|
check.error(tdecl, "type aliases only supported as of -lang=go1.9")
|
||||||
|
} else {
|
||||||
check.error(tdecl, "type aliases requires go1.9 or later")
|
check.error(tdecl, "type aliases requires go1.9 or later")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
obj.typ = Typ[Invalid]
|
obj.typ = Typ[Invalid]
|
||||||
obj.typ = check.anyType(tdecl.Type)
|
obj.typ = check.anyType(tdecl.Type)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue