cmd/compile/internal/types2: don't crash if import path is missing #43190
package p import
causes a crash for types2 with
The problem is that the syntax parser returns nil *syntax.ImportDecl values when the import path is missing; and those nil values are added to decl lists even though they should be ignored.
The text was updated successfully, but these errors were encountered:
…ath 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 <email@example.com> Reviewed-by: Robert Findley <firstname.lastname@example.org>