-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix panic when accessing the package name of a prelude object
Patches a bug introduced in v1.12.0.
- Loading branch information
Showing
5 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module regression | ||
|
||
go 1.22.3 |
Empty file.
10 changes: 10 additions & 0 deletions
10
testdata/src/regression/prelude_functions_have_no_package.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package regression_test | ||
|
||
import "testing" | ||
|
||
func TestPreludeFunctionsHaveNoPkg(t *testing.T) { | ||
// Prelude definitions have no package, which means that "go/types".Object.Pkg() returns nil, | ||
// which in turn panics when its method Name() is called. | ||
var items []int | ||
items = append(items, 0) | ||
} |