Commit 1fe8fdf7 authored by Andrew Wilkins's avatar Andrew Wilkins Committed by Robert Griesemer

go/types: Use left-hand side's type as hint for right-hand

side expression evaluation in assignment operations.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/7349046
parent 7fdaec6c
...@@ -61,7 +61,7 @@ var tests = []string{ ...@@ -61,7 +61,7 @@ var tests = []string{
"bufio", "bufio",
"bytes", "bytes",
// "compress/bzip2", "compress/bzip2",
"compress/flate", "compress/flate",
"compress/gzip", "compress/gzip",
// "compress/lzw", // "compress/lzw",
...@@ -80,7 +80,7 @@ var tests = []string{ ...@@ -80,7 +80,7 @@ var tests = []string{
"crypto/elliptic", "crypto/elliptic",
"crypto/hmac", "crypto/hmac",
"crypto/md5", "crypto/md5",
// "crypto/rand", "crypto/rand",
"crypto/rc4", "crypto/rc4",
"crypto/rsa", "crypto/rsa",
"crypto/sha1", "crypto/sha1",
...@@ -126,7 +126,7 @@ var tests = []string{ ...@@ -126,7 +126,7 @@ var tests = []string{
"go/parser", "go/parser",
"go/printer", "go/printer",
"go/scanner", "go/scanner",
// "go/token", "go/token",
"go/types", "go/types",
"hash/adler32", "hash/adler32",
...@@ -138,7 +138,7 @@ var tests = []string{ ...@@ -138,7 +138,7 @@ var tests = []string{
"image/color", "image/color",
"image/draw", "image/draw",
"image/gif", "image/gif",
// "image/jpeg", "image/jpeg",
"image/png", "image/png",
"index/suffixarray", "index/suffixarray",
...@@ -149,7 +149,7 @@ var tests = []string{ ...@@ -149,7 +149,7 @@ var tests = []string{
"log", "log",
"log/syslog", "log/syslog",
// "math", "math",
//"math/big", //"math/big",
"math/cmplx", "math/cmplx",
"math/rand", "math/rand",
...@@ -168,7 +168,7 @@ var tests = []string{ ...@@ -168,7 +168,7 @@ var tests = []string{
"net/rpc", "net/rpc",
"net/rpc/jsonrpc", "net/rpc/jsonrpc",
"net/smtp", "net/smtp",
// "net/textproto", "net/textproto",
"net/url", "net/url",
"path", "path",
......
...@@ -403,11 +403,13 @@ func (check *checker) stmt(s ast.Stmt) { ...@@ -403,11 +403,13 @@ func (check *checker) stmt(s ast.Stmt) {
return return
} }
var x, y operand var x, y operand
// The lhs operand's type doesn't need a hint (from the rhs operand),
// because it must be a fully typed variable in this case.
check.expr(&x, s.Lhs[0], nil, -1) check.expr(&x, s.Lhs[0], nil, -1)
if x.mode == invalid { if x.mode == invalid {
return return
} }
check.expr(&y, s.Rhs[0], nil, -1) check.expr(&y, s.Rhs[0], x.typ, -1)
if y.mode == invalid { if y.mode == invalid {
return return
} }
......
...@@ -29,6 +29,9 @@ func _() { ...@@ -29,6 +29,9 @@ func _() {
s += "bar" s += "bar"
s += 1 /* ERROR "cannot convert.*string" */ s += 1 /* ERROR "cannot convert.*string" */
var u64 uint64
u64 += 1<<u64
} }
func _incdecs() { func _incdecs() {
...@@ -271,4 +274,4 @@ func _rangeloops() { ...@@ -271,4 +274,4 @@ func _rangeloops() {
var xx rune var xx rune
xx = x xx = x
} }
} }
\ No newline at end of file
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