fix: blank identifier cause panic (#255)
This commit is contained in:
committed by
Ludovic Fernandez
parent
172d4a4657
commit
f2034819c2
9
_test/assign8.go
Normal file
9
_test/assign8.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
_ = 1
|
||||||
|
println(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output:
|
||||||
|
// 1
|
||||||
@@ -343,7 +343,7 @@ func (interp *Interpreter) cfg(root *node) ([]*node, error) {
|
|||||||
dest, src := n.child[i], n.child[sbase+i]
|
dest, src := n.child[i], n.child[sbase+i]
|
||||||
var sym *symbol
|
var sym *symbol
|
||||||
var level int
|
var level int
|
||||||
if n.kind == defineStmt {
|
if n.kind == defineStmt || (n.kind == assignStmt && dest.ident == "_") {
|
||||||
if src.typ != nil && src.typ.cat == nilT {
|
if src.typ != nil && src.typ.cat == nilT {
|
||||||
err = src.cfgErrorf("use of untyped nil")
|
err = src.cfgErrorf("use of untyped nil")
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user