Source file test/fixedbugs/bug331.go

     1  // run
     2  
     3  // Copyright 2011 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package main
     8  
     9  import "io"
    10  
    11  func f() (_ string, x float64, err error) {
    12  	return
    13  }
    14  
    15  func g() (_ string, x float64, err error) {
    16  	return "hello", 3.14, io.EOF
    17  }
    18  
    19  var _ func() (string, float64, error) = f
    20  var _ func() (string, float64, error) = g
    21  
    22  func main() {
    23  	x, y, z := g()
    24  	if x != "hello" || y != 3.14 || z != io.EOF {
    25  		println("wrong", x, len(x), y, z)
    26  	}
    27  }
    28  
    29  /*
    30  issue 1712
    31  
    32  bug331.go:12: cannot use "hello" (type string) as type float64 in assignment
    33  bug331.go:12: cannot use 0 (type float64) as type os.Error in assignment:
    34  	float64 does not implement os.Error (missing String method)
    35  bug331.go:12: error in shape across RETURN
    36  */
    37  

View as plain text