mirror of
https://github.com/golang/go
synced 2024-11-26 07:38:00 -07: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
@ -602,8 +602,12 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *syntax.TypeDecl, def *Named
|
||||
if alias {
|
||||
// type alias declaration
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
obj.typ = Typ[Invalid]
|
||||
obj.typ = check.anyType(tdecl.Type)
|
||||
|
Loading…
Reference in New Issue
Block a user