Initial commit: Go 1.23 release state
This commit is contained in:
23
test/typeparam/issue50598.dir/a0.go
Normal file
23
test/typeparam/issue50598.dir/a0.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright 2022 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.
|
||||
|
||||
package a0
|
||||
|
||||
type Builder[T any] struct{}
|
||||
|
||||
func (r Builder[T]) New1() T {
|
||||
var v T
|
||||
return v
|
||||
}
|
||||
|
||||
func (r Builder[T]) New2() T {
|
||||
var v T
|
||||
return v
|
||||
}
|
||||
|
||||
type IntBuilder struct{}
|
||||
|
||||
func (b IntBuilder) New() int {
|
||||
return Builder[int]{}.New2()
|
||||
}
|
||||
11
test/typeparam/issue50598.dir/a1.go
Normal file
11
test/typeparam/issue50598.dir/a1.go
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright 2022 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.
|
||||
|
||||
package a1
|
||||
|
||||
import "./a0"
|
||||
|
||||
func New() int {
|
||||
return a0.IntBuilder{}.New()
|
||||
}
|
||||
11
test/typeparam/issue50598.dir/a2.go
Normal file
11
test/typeparam/issue50598.dir/a2.go
Normal file
@@ -0,0 +1,11 @@
|
||||
// Copyright 2022 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.
|
||||
|
||||
package a2
|
||||
|
||||
import "./a0"
|
||||
|
||||
func New() int {
|
||||
return a0.Builder[int]{}.New1()
|
||||
}
|
||||
22
test/typeparam/issue50598.dir/main.go
Normal file
22
test/typeparam/issue50598.dir/main.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2022 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.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"./a1"
|
||||
"./a2"
|
||||
)
|
||||
|
||||
func New() int {
|
||||
return a1.New() + a2.New()
|
||||
}
|
||||
|
||||
func main() {
|
||||
if got, want := New(), 0; got != want {
|
||||
panic(fmt.Sprintf("got %d, want %d", got, want))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user