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/32324
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go
index 6f0f4f5..23c60fa 100644
--- a/src/cmd/compile/internal/gc/typecheck.go
+++ b/src/cmd/compile/internal/gc/typecheck.go
@@ -3113,7 +3113,6 @@
 	}
 
 	if nerr != nerrors {
-		n.Type = nil
 		return n
 	}
 
diff --git a/test/fixedbugs/issue17645.go b/test/fixedbugs/issue17645.go
new file mode 100644
index 0000000..ed92c54
--- /dev/null
+++ b/test/fixedbugs/issue17645.go
@@ -0,0 +1,17 @@
+// 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"
+}
+