diff --git a/src/cmd/compile/internal/logopt/log_opts.go b/src/cmd/compile/internal/logopt/log_opts.go index 711b5b9d75c23f..5c7f580f0b2b70 100644 --- a/src/cmd/compile/internal/logopt/log_opts.go +++ b/src/cmd/compile/internal/logopt/log_opts.go @@ -405,6 +405,9 @@ func uriIfy(f string) DocumentURI { // Return filename, replacing a first occurrence of $GOROOT with the // actual value of the GOROOT (because LSP does not speak "$GOROOT"). func uprootedPath(filename string) string { + if filename == "" { + return "__unnamed__" + } if buildcfg.GOROOT == "" || !strings.HasPrefix(filename, "$GOROOT/") { return filename } diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go index f4e6b92bd641c2..8329837a308a00 100644 --- a/src/cmd/compile/internal/types/type.go +++ b/src/cmd/compile/internal/types/type.go @@ -1680,7 +1680,7 @@ func FakeRecvType() *Type { } func FakeRecv() *Field { - return NewField(src.NoXPos, nil, FakeRecvType()) + return NewField(base.AutogeneratedPos, nil, FakeRecvType()) } var (