Skip to content

Commit

Permalink
test/typeparam: add a test case for issue48617
Browse files Browse the repository at this point in the history
For golang#48617

Change-Id: I6c00b7912c441ac323a0adede63b7d4a9ae6f92d
Reviewed-on: https://go-review.googlesource.com/c/go/+/351858
Reviewed-by: Cuong Manh Le <[email protected]>
Reviewed-by: Dan Scales <[email protected]>
Trust: Cuong Manh Le <[email protected]>
Trust: Dan Scales <[email protected]>
Run-TryBot: Cuong Manh Le <[email protected]>
TryBot-Result: Go Bot <[email protected]>
  • Loading branch information
korzhao authored and danscales committed Sep 25, 2021
1 parent ba76730 commit aeea5ba
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/typeparam/issue48617.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// run -gcflags=-G=3

// Copyright 2021 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

type Foo[T any] interface {
CreateBar() Bar[T]
}

type Bar[T any] func() Bar[T]

func (f Bar[T]) CreateBar() Bar[T] {
return f
}

func abc[T any]() {
var b Bar[T] = func() Bar[T] {
var b Bar[T]
return b
}
var _ Foo[T] = b()
}

func main() {
abc[int]()
}

0 comments on commit aeea5ba

Please sign in to comment.