aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder/noder.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-06-12 18:44:51 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-06-13 03:10:49 +0000
commit8eeaf961c50973b0aa2065d2c31dfa5d9949bf93 (patch)
tree1dec24ad22337da8a0c31e664404d2ec167e4805 /src/cmd/compile/internal/noder/noder.go
parentf1b1c2f67fae0598db5c20f324334c23d4cd3038 (diff)
downloadgo-8eeaf961c50973b0aa2065d2c31dfa5d9949bf93.tar.gz
go-8eeaf961c50973b0aa2065d2c31dfa5d9949bf93.zip
[dev.typeparams] cmd/compile: move //go:embed -lang check to noder
User errors should be reported in noder and/or typecheck, we already know the -lang flag's value during noding, and checking it then works better for unified IR. The "multiple files for type" and "cannot apply to var of type" errors should also be moved to typecheck, but then they'd have to be duplicated for -G=3 mode (because it avoids typecheck). So those are left behind for now. Change-Id: I7caf16163c9faf975784acacdb8147514d2e698e Reviewed-on: https://go-review.googlesource.com/c/go/+/327609 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/noder/noder.go')
-rw-r--r--src/cmd/compile/internal/noder/noder.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/noder.go b/src/cmd/compile/internal/noder/noder.go
index 63822d3089..d417edcbd5 100644
--- a/src/cmd/compile/internal/noder/noder.go
+++ b/src/cmd/compile/internal/noder/noder.go
@@ -1886,6 +1886,8 @@ func checkEmbed(decl *syntax.VarDecl, haveEmbed, withinFunc bool) error {
return errors.New("go:embed cannot apply to var without type")
case withinFunc:
return errors.New("go:embed cannot apply to var inside func")
+ case !types.AllowsGoVersion(types.LocalPkg, 1, 16):
+ return fmt.Errorf("go:embed requires go1.16 or later (-lang was set to %s; check go.mod)", base.Flag.Lang)
default:
return nil