diff options
author | Robert Griesemer <gri@golang.org> | 2020-12-14 17:23:00 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2020-12-15 19:44:38 +0000 |
commit | 6b18081d01f6f87b9af9e5b3910f1379d52a13eb (patch) | |
tree | 4d660d75989a3692c8e9d925ac3d5c4f4f470d6b /src/cmd/compile/internal/syntax/nodes.go | |
parent | 14e4267c3446fe30bb1c7a1a874dc7e18c1d38d1 (diff) | |
download | go-6b18081d01f6f87b9af9e5b3910f1379d52a13eb.tar.gz go-6b18081d01f6f87b9af9e5b3910f1379d52a13eb.zip |
[dev.typeparams] cmd/compile/internal/types2: don't crash if import path is missing
In package syntax:
- fix parser appendGroup to not add nil entries
- non-string paths are syntax errors per the spec; report in parser
- document ImportDecl.Path invariants
In package types2:
- guard against absent paths
In package gc:
- guard against absent paths
Fixes #43190.
Change-Id: Ic6a06f6a96b7f519feaa1ceaf4376fc5ab0f0129
Reviewed-on: https://go-review.googlesource.com/c/go/+/278114
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/syntax/nodes.go')
-rw-r--r-- | src/cmd/compile/internal/syntax/nodes.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/syntax/nodes.go b/src/cmd/compile/internal/syntax/nodes.go index fe8f62c6e6..a06d6e85b1 100644 --- a/src/cmd/compile/internal/syntax/nodes.go +++ b/src/cmd/compile/internal/syntax/nodes.go @@ -55,8 +55,8 @@ type ( ImportDecl struct { Group *Group // nil means not part of a group Pragma Pragma - LocalPkgName *Name // including "."; nil means no rename present - Path *BasicLit + LocalPkgName *Name // including "."; nil means no rename present + Path *BasicLit // Path.Bad || Path.Kind == StringLit; nil means no path decl } |