// the context in which the result will be interpreted.
type ShellString string;
func (s ShellString) String() string {
- return dollarString(s, "{", "}");
+ return dollarString(string(s), "{", "}");
}
type MakeString string;
func (s MakeString) String() string {
- return dollarString(s, "(", ")");
+ return dollarString(string(s), "(", ")");
}
// TODO(rsc): parse.Parse should return an os.Error.
ILLEGAL Token = iota;
EOF;
COMMENT;
-
+
// Identifiers and basic type literals
// (these tokens stand for classes of literals)
literal_beg;
if str, exists := tokens[tok]; exists {
return str;
}
- return "token(" + strconv.Itoa(tok) + ")";
+ return "token(" + strconv.Itoa(int(tok)) + ")";
}
// Redirect to a fixed URL
type redirectHandler string
func (url redirectHandler) ServeHTTP(c *Conn, req *Request) {
- Redirect(c, url);
+ Redirect(c, string(url));
}
// RedirectHandler returns a request handler that redirects
// Error.
type ErrorString string
func (e ErrorString) String() string {
- return e
+ return string(e)
}
// NewError converts s to an ErrorString, which satisfies the Error interface.
// wrappers to convert the error number into an Error.
type Errno int64
func (e Errno) String() string {
- return syscall.Errstr(e)
+ return syscall.Errstr(int64(e))
}
// ErrnoToError converts errno to an Error (underneath, an Errno).
// Generic error handler, called only from execError or parseError.
func error(errors chan os.Error, line int, err string, args ...) {
- errors <- ParseError{fmt.Sprintf("line %d: %s", line, fmt.Sprintf(err, args))};
+ errors <- ParseError{os.ErrorString(fmt.Sprintf("line %d: %s", line, fmt.Sprintf(err, args)))};
runtime.Goexit();
}
// the error.
func (t *Template) Parse(s string) os.Error {
if !validDelim(t.ldelim) || !validDelim(t.rdelim) {
- return ParseError{fmt.Sprintf("bad delimiter strings %q %q", t.ldelim, t.rdelim)}
+ return ParseError{os.ErrorString(fmt.Sprintf("bad delimiter strings %q %q", t.ldelim, t.rdelim))}
}
t.buf = io.StringBytes(s);
t.p = 0;
Error:
if tzerr, ok := err.(TimeZoneError); ok {
- tzerr.ErrorString += ": " + name
+ tzerr.ErrorString = os.ErrorString(tzerr.String() + ": " + name)
}
return nil, err
}
panicln("type of f is", t, "want", want);
}
- want = typeof(x);
+ want = typeof(a);
if t := typeof(+a); t != want {
panicln("type of +a is", t, "want", want);
}
if t := typeof(a+0); t != want {
panicln("type of a+0 is", t, "want", want);
}
- if t := typeof(a+b); t != want {
- panicln("type of a+b is", t, "want", want);
- }
}
=========== fixedbugs/bug050.go
fixedbugs/bug050.go:3: package statement must be first
-sys.6:1 fixedbugs/bug050.go:3: syntax error near package
=========== fixedbugs/bug051.go
fixedbugs/bug051.go:10: expression must be a constant
--- /dev/null
+// $G $D/$F.go
+
+// Copyright 2009 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.
+
+// check that when import gives multiple names
+// to a type, they're still all the same type
+
+package main
+
+import _os_ "os"
+import "os"
+import . "os"
+
+func f(e os.Error)
+
+func main() {
+ var _e_ _os_.Error;
+ var dot Error;
+
+ f(_e_);
+ f(dot);
+}
+
type Inter interface { M() int64 }
type T int64
-func (t T) M() int64 { return t }
+func (t T) M() int64 { return int64(t) }
var t = T(Value)
var pt = &t
var ti Inter = t
if err != nil {
panic("scanner error?");
}
-
+
p.next();
return io.StringBytes(s);
}
p.next();
tname = p.parseName();
}
-
+
return &field{fname, tname};
}
name := p.parseName();
p.expect(token.ASSIGN);
x := p.parseExpr();
- return name, x;
+ return name, x;
}
func (p *parser) parseFormat() Format {
format := make(Format);
-
+
for p.tok != token.EOF {
pos := p.pos;
name, x := p.parseProd();
}
}
p.expect(token.EOF);
-
+
return format;
}
type formatError string
func (p formatError) String() string {
- return p;
+ return string(p);
}
if p.errors.Len() > 0 {
return nil, formatError(string(p.errors.Data()));
}
-
+
return f, nil;
}
case reflect.Uint8Kind: name = "uint8";
case reflect.UintptrKind: name = "uintptr";
}
-
+
return name;
}
panic();
}
*/
-
+
if fexpr, found := f[name]; found {
return fexpr;
}
-
+
if *debug {
fmt.Printf("no production for type: %s\n", name);
}
type state struct {
f Format;
-
+
// indentation
indent_text []byte;
indent_widths []int;
w.Write(buf.Data());
}
return true;
-
+
case *option:
// print the contents of the option if it contains a non-empty field
var buf io.ByteBuffer;
buf.Reset();
}
return true;
-
+
case *custom:
var buf io.ByteBuffer;
if t.form(&buf, value.Interface(), t.name) {