Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not panic when assigning to _ (blank) var. #1620

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.*.swo
.*.swp
*.dot
*.out
.idea/
/yaegi
internal/cmd/extract/extract
Expand Down
9 changes: 9 additions & 0 deletions _test/op10.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

func main() {
_ = 1 + 1
println("ok")
}

// Output:
// ok
10 changes: 10 additions & 0 deletions _test/op11.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package main

func main() {
a, b := 1, 2
_ = a + b
println("ok")
}

// Output:
// ok
2 changes: 1 addition & 1 deletion interp/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -2393,7 +2393,7 @@ func isMap(t *itype) bool { return t.TypeOf().Kind() == reflect.Map }
func isPtr(t *itype) bool { return t.TypeOf().Kind() == reflect.Ptr }

func isEmptyInterface(t *itype) bool {
return t.cat == interfaceT && len(t.field) == 0
return t != nil && t.cat == interfaceT && len(t.field) == 0
}

func isGeneric(t *itype) bool {
Expand Down
Loading