mirror of
https://github.com/golang/go
synced 2024-11-22 05:34:39 -07:00
gc: Use %#F in error messages instead of %F.
Fixes #2520 R=rsc CC=golang-dev https://golang.org/cl/5482056
This commit is contained in:
parent
6a401339c1
commit
3c638f2892
@ -371,9 +371,13 @@ Vconv(Fmt *fp)
|
|||||||
return fmtprint(fp, "'\\U%08llux'", x);
|
return fmtprint(fp, "'\\U%08llux'", x);
|
||||||
return fmtprint(fp, "('\\x00' + %B)", v->u.xval);
|
return fmtprint(fp, "('\\x00' + %B)", v->u.xval);
|
||||||
case CTFLT:
|
case CTFLT:
|
||||||
|
if((fp->flags & FmtSharp) || fmtmode == FExp)
|
||||||
return fmtprint(fp, "%F", v->u.fval);
|
return fmtprint(fp, "%F", v->u.fval);
|
||||||
case CTCPLX: // ? 1234i -> (0p+0+617p+1)
|
return fmtprint(fp, "%#F", v->u.fval);
|
||||||
|
case CTCPLX:
|
||||||
|
if((fp->flags & FmtSharp) || fmtmode == FExp)
|
||||||
return fmtprint(fp, "(%F+%F)", &v->u.cval->real, &v->u.cval->imag);
|
return fmtprint(fp, "(%F+%F)", &v->u.cval->real, &v->u.cval->imag);
|
||||||
|
return fmtprint(fp, "(%#F + %#Fi)", &v->u.cval->real, &v->u.cval->imag);
|
||||||
case CTSTR:
|
case CTSTR:
|
||||||
return fmtprint(fp, "\"%Z\"", v->u.sval);
|
return fmtprint(fp, "\"%Z\"", v->u.sval);
|
||||||
case CTBOOL:
|
case CTBOOL:
|
||||||
|
13
test/fixedbugs/bug383.go
Normal file
13
test/fixedbugs/bug383.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// errchk $G $D/$F.go
|
||||||
|
|
||||||
|
// Copyright 2011 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.
|
||||||
|
|
||||||
|
// Issue 2520
|
||||||
|
|
||||||
|
package main
|
||||||
|
func main() {
|
||||||
|
if 2e9 { } // ERROR "2e.09"
|
||||||
|
if 3.14+1i { } // ERROR "3.14 . 1i"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user