Commit 9a8bf2d6 authored by Dhananjay Nakrani's avatar Dhananjay Nakrani Committed by Matthew Dempsky

cmd/compile: avoid nil-ing out a node's Type in typecheckcomplit() on error

typecheckcomplit nils out node's type, upon finding new errors.
This hides new errors in children's node as well as the type info
of current node. This change fixes that.

Fixes #17645.

Change-Id: Ib473291f31c7e8fa0307cb1d494e0c112ddd3583
Reviewed-on: https://go-review.googlesource.com/32324Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent d35dfd40
......@@ -3113,7 +3113,6 @@ func typecheckcomplit(n *Node) *Node {
}
if nerr != nerrors {
n.Type = nil
return n
}
......
// errorcheck
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
type Foo struct {
X int
}
func main() {
var s []int
var _ string = append(s, Foo{""}) // ERROR "cannot use .. \(type string\) as type int in field value" "cannot use Foo literal \(type Foo\) as type int in append" "cannot use append\(s\, Foo literal\) \(type \[\]int\) as type string in assignment"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment