Source file test/typeparam/issue47892.dir/main.go

     1  // Copyright 2021 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 main
     6  
     7  import "./a"
     8  
     9  type Model[T any] struct {
    10  	index a.Index[T]
    11  }
    12  
    13  func NewModel[T any](index a.Index[T]) Model[T] {
    14  	return Model[T]{
    15  		index: index,
    16  	}
    17  }
    18  
    19  func main() {
    20  	_ = NewModel[int]((*a.I1[int])(nil))
    21  }
    22  

View as plain text