Source file src/internal/types/testdata/fixedbugs/issue54942.go

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package p
     6  
     7  import (
     8  	"context"
     9  	"database/sql"
    10  )
    11  
    12  type I interface {
    13  	m(int, int, *int, int)
    14  }
    15  
    16  type T struct{}
    17  
    18  func (_ *T) m(a, b, c, d int) {}
    19  
    20  var _ I = new /* ERROR "have m(int, int, int, int)\n\t\twant m(int, int, *int, int)" */ (T)
    21  
    22  // (slightly modified) test case from issue
    23  
    24  type Result struct {
    25  	Value string
    26  }
    27  
    28  type Executor interface {
    29  	Execute(context.Context, sql.Stmt, int, []sql.NamedArg, int) (Result, error)
    30  }
    31  
    32  type myExecutor struct{}
    33  
    34  func (_ *myExecutor) Execute(ctx context.Context, stmt sql.Stmt, maxrows int, args []sql.NamedArg, urgency int) (*Result, error) {
    35  	return &Result{}, nil
    36  }
    37  
    38  var ex Executor = new /* ERROR "have Execute(context.Context, sql.Stmt, int, []sql.NamedArg, int) (*Result, error)\n\t\twant Execute(context.Context, sql.Stmt, int, []sql.NamedArg, int) (Result, error)" */ (myExecutor)
    39  

View as plain text