diff --git a/src/cmd/compile/internal/logopt/log_opts.go b/src/cmd/compile/internal/logopt/log_opts.go index 711b5b9d75..5c7f580f0b 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 f4e6b92bd6..8329837a30 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 (