summaryrefslogtreecommitdiff
path: root/libgo/go/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-02-18 05:56:46 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-02-18 05:56:46 +0000
commit43414a5dd3a9b9b02bc675e1c33140021c3848aa (patch)
tree66790d16b1ce811193f21d132f271823d10b20f9 /libgo/go/go
parentfa837fb670c502e7fbcb3f48aa1932b55704521c (diff)
libgo: Update to final Go 1.6 release.
Reviewed-on: https://go-review.googlesource.com/19592 From-SVN: r233515
Diffstat (limited to 'libgo/go/go')
-rw-r--r--libgo/go/go/constant/value.go2
-rw-r--r--libgo/go/go/constant/value_test.go2
-rw-r--r--libgo/go/go/internal/gcimporter/gcimporter.go6
-rw-r--r--libgo/go/go/types/expr.go8
-rw-r--r--libgo/go/go/types/resolver.go10
5 files changed, 17 insertions, 11 deletions
diff --git a/libgo/go/go/constant/value.go b/libgo/go/go/constant/value.go
index 630581047a2..310814df71c 100644
--- a/libgo/go/go/constant/value.go
+++ b/libgo/go/go/constant/value.go
@@ -96,7 +96,7 @@ func (x stringVal) String() string {
// only the first maxLen-3 runes; then add "...".
i := 0
for n := 0; n < maxLen-3; n++ {
- _, size := utf8.DecodeRuneInString(s)
+ _, size := utf8.DecodeRuneInString(s[i:])
i += size
}
s = s[:i] + "..."
diff --git a/libgo/go/go/constant/value_test.go b/libgo/go/go/constant/value_test.go
index de1ab0267a4..dbd96c07a31 100644
--- a/libgo/go/go/constant/value_test.go
+++ b/libgo/go/go/constant/value_test.go
@@ -204,6 +204,7 @@ func eql(x, y Value) bool {
// String tests
var xxx = strings.Repeat("x", 68)
+var issue14262 = `"بموجب الشروط التالية نسب المصنف — يجب عليك أن تنسب العمل بالطريقة التي تحددها المؤلف أو المرخص (ولكن ليس بأي حال من الأحوال أن توحي وتقترح بتحول أو استخدامك للعمل). المشاركة على قدم المساواة — إذا كنت يعدل ، والتغيير ، أو الاستفادة من هذا العمل ، قد ينتج عن توزيع العمل إلا في ظل تشابه او تطابق فى واحد لهذا الترخيص."`
var stringTests = []struct {
input, short, exact string
@@ -225,6 +226,7 @@ var stringTests = []struct {
{`"` + xxx + `xx"`, `"` + xxx + `xx"`, `"` + xxx + `xx"`},
{`"` + xxx + `xxx"`, `"` + xxx + `...`, `"` + xxx + `xxx"`},
{`"` + xxx + xxx + `xxx"`, `"` + xxx + `...`, `"` + xxx + xxx + `xxx"`},
+ {issue14262, `"بموجب الشروط التالية نسب المصنف — يجب عليك أن تنسب العمل بالطريقة ال...`, issue14262},
// Int
{"0", "0", "0"},
diff --git a/libgo/go/go/internal/gcimporter/gcimporter.go b/libgo/go/go/internal/gcimporter/gcimporter.go
index 0ef8eb4fc6c..d70ec083c33 100644
--- a/libgo/go/go/internal/gcimporter/gcimporter.go
+++ b/libgo/go/go/internal/gcimporter/gcimporter.go
@@ -31,7 +31,8 @@ var pkgExts = [...]string{".a", ".o"}
// FindPkg returns the filename and unique package id for an import
// path based on package information provided by build.Import (using
-// the build.Default build.Context).
+// the build.Default build.Context). A relative srcDir is interpreted
+// relative to the current working directory.
// If no file was found, an empty filename is returned.
//
func FindPkg(path, srcDir string) (filename, id string) {
@@ -44,6 +45,9 @@ func FindPkg(path, srcDir string) (filename, id string) {
default:
// "x" -> "$GOPATH/pkg/$GOOS_$GOARCH/x.ext", "x"
// Don't require the source files to be present.
+ if abs, err := filepath.Abs(srcDir); err == nil { // see issue 14282
+ srcDir = abs
+ }
bp, _ := build.Import(path, srcDir, build.FindOnly|build.AllowBinary)
if bp.PkgObj == "" {
return
diff --git a/libgo/go/go/types/expr.go b/libgo/go/go/types/expr.go
index 942d3fd5f73..f7c4a173785 100644
--- a/libgo/go/go/types/expr.go
+++ b/libgo/go/go/types/expr.go
@@ -184,7 +184,8 @@ func roundFloat64(x constant.Value) constant.Value {
// provided (only needed for int/uint sizes).
//
// If rounded != nil, *rounded is set to the rounded value of x for
-// representable floating-point values; it is left alone otherwise.
+// representable floating-point and complex values, and to an Int
+// value for integer values; it is left alone otherwise.
// It is ok to provide the addressof the first argument for rounded.
func representableConst(x constant.Value, conf *Config, typ *Basic, rounded *constant.Value) bool {
if x.Kind() == constant.Unknown {
@@ -197,6 +198,9 @@ func representableConst(x constant.Value, conf *Config, typ *Basic, rounded *con
if x.Kind() != constant.Int {
return false
}
+ if rounded != nil {
+ *rounded = x
+ }
if x, ok := constant.Int64Val(x); ok {
switch typ.kind {
case Int:
@@ -808,8 +812,6 @@ func (check *Checker) binary(x *operand, e *ast.BinaryExpr, lhs, rhs ast.Expr, o
typ := x.typ.Underlying().(*Basic)
// force integer division of integer operands
if op == token.QUO && isInteger(typ) {
- xval = constant.ToInt(xval)
- yval = constant.ToInt(yval)
op = token.QUO_ASSIGN
}
x.val = constant.BinaryOp(xval, op, yval)
diff --git a/libgo/go/go/types/resolver.go b/libgo/go/go/types/resolver.go
index 14148a585b1..1536df5bf1b 100644
--- a/libgo/go/go/types/resolver.go
+++ b/libgo/go/go/types/resolver.go
@@ -483,11 +483,9 @@ func pkgName(path string) string {
// (Per the go/build package dependency tests, we cannot import
// path/filepath and simply use filepath.Dir.)
func dir(path string) string {
- if i := strings.LastIndexAny(path, "/\\"); i >= 0 {
- path = path[:i]
+ if i := strings.LastIndexAny(path, `/\`); i > 0 {
+ return path[:i]
}
- if path == "" {
- path = "."
- }
- return path
+ // i <= 0
+ return "."
}