]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/types2: match compiler error for invalid type alias decl
authorRobert Griesemer <gri@golang.org>
Thu, 29 Apr 2021 01:00:16 +0000 (18:00 -0700)
committerDan Scales <danscales@google.com>
Thu, 29 Apr 2021 04:59:52 +0000 (04:59 +0000)
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>
src/cmd/compile/internal/types2/decl.go

index 178bebe2ecad0cb7b9ec6b0d287f7b21a31c8705..4966f198921de386f1f169d98c72fea17d3bc88a 100644 (file)
@@ -602,7 +602,11 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *syntax.TypeDecl, def *Named
        if alias {
                // type alias declaration
                if !check.allowVersion(obj.pkg, 1, 9) {
-                       check.error(tdecl, "type aliases requires go1.9 or later")
+                       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]