Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 311 for Instantiations (0.17 sec)

  1. test/typeparam/smoketest.go

    func f2[P1, P2 any, P3 any]() {}
    func f3[P interface{}](x P, y T1[int]) {}
    
    // function instantiations
    var _ = f1[int]
    var _ = f2[int, string, struct{}]
    var _ = f3[bool]
    
    // type parameters for types
    type T1[P any] struct{}
    type T2[P1, P2 any, P3 any] struct{}
    type T3[P interface{}] interface{}
    
    // type instantiations
    type _ T1[int]
    type _ T2[int, string, struct{}]
    type _ T3[bool]
    
    // methods
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 1019 bytes
    - Viewed (0)
  2. test/typeparam/dedup.go

    // 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.
    
    // Note: this doesn't really test the deduplication of
    // instantiations. It just provides an easy mechanism to build a
    // binary that you can then check with objdump manually to make sure
    // deduplication is happening. TODO: automate this somehow?
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 437 bytes
    - Viewed (0)
  3. test/typeparam/issue54456.go

    // run
    
    // 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.
    
    // The Go 1.18 frontend failed to disambiguate instantiations of
    // different, locally defined generic types with the same name.
    //
    // The unified frontend also exposed the scope-disambiguation mangling
    // to end users in reflect data.
    
    package main
    
    import (
    	"reflect"
    )
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 23 18:13:48 UTC 2022
    - 898 bytes
    - Viewed (0)
  4. src/cmd/vendor/golang.org/x/tools/internal/typeparams/common.go

    	// subset of the type set of the corresponding type parameter of T, meaning
    	// that every instantiation of V corresponds to a valid instantiation of T.
    
    	// Minor optimization: ensure we share a context across the two
    	// instantiations below.
    	if ctxt == nil {
    		ctxt = types.NewContext()
    	}
    
    	var targs []types.Type
    	for i := 0; i < vtparams.Len(); i++ {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 02:38:00 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  5. test/typeparam/issue49659b.go

    // 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.
    
    // Testing that AddrTaken logic doesn't cause problems for function instantiations
    
    package main
    
    type A[T interface{ []int | [5]int }] struct {
    	val T
    }
    
    //go:noinline
    func (a A[T]) F() {
    	_ = &a.val[2]
    }
    
    func main() {
    	var x A[[]int]
    	x.val = make([]int, 4)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 492 bytes
    - Viewed (0)
  6. test/typeparam/issue50002.go

    		}()
    	}
    	_ = x.(A)
    	if !shouldMatch {
    		fmt.Printf("Should have panicked")
    	}
    }
    
    func main() {
    	// Test instantiation where the type switch/type asserts can't possibly succeed
    	// (since string does not implement I[byte]).
    	F[byte, string](S{}, false)
    
    	// Test instantiation where the type switch/type asserts should succeed
    	// (since S does implement I[byte])
    	F[byte, S](S{}, true)
    	F[byte, S](I[byte](S{}), true)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 1.3K bytes
    - Viewed (0)
  7. test/typeparam/valimp.dir/a.go

    // license that can be found in the LICENSE file.
    
    package a
    
    type Value[T any] struct {
    	val T
    }
    
    // The noinline directive should survive across import, and prevent instantiations
    // of these functions from being inlined.
    
    //go:noinline
    func Get[T any](v *Value[T]) T {
    	return v.val
    }
    
    //go:noinline
    func Set[T any](v *Value[T], val T) {
    	v.val = val
    }
    
    //go:noinline
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jul 28 21:40:40 UTC 2021
    - 587 bytes
    - Viewed (0)
  8. src/cmd/compile/internal/syntax/testdata/smoketest.go

    type _[A interface{}] struct{}
    type _[A, B interface{ m() }] struct{}
    
    type _[A, B, C any] struct{}
    
    // in functions
    func _[P any]()
    func _[P interface{}]()
    func _[P B]()
    func _[P B[P]]()
    
    // type instantiations
    type _ T[int]
    
    // in expressions
    var _ = T[int]{}
    
    // in embedded types
    type _ struct{ T[int] }
    
    // interfaces
    type _ interface {
    	m()
    	~int
    }
    
    type _ interface {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 30 18:02:31 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/test/race.go

    // the racecompile builder.
    //
    // This package is not imported so functions here are not included
    // in the actual compiler.
    
    // Issue 55357: data race when building multiple instantiations of
    // generic closures with _ parameters.
    func Issue55357() {
    	type U struct {
    		A int
    		B string
    		C string
    	}
    	var q T55357[U]
    	q.Count()
    	q.List()
    
    	type M struct {
    		A int64
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 20 22:16:41 UTC 2022
    - 1.3K bytes
    - Viewed (0)
  10. src/internal/types/testdata/fixedbugs/issue52698.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package p
    
    // correctness check: ensure that cycles through generic instantiations are detected
    type T[P any] struct {
    	_ P
    }
    
    type S /* ERROR "invalid recursive type" */ struct {
    	_ T[S]
    }
    
    // simplified test 1
    
    var _ A1[A1[string]]
    
    type A1[P any] struct {
    	_ B1[P]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:54:25 UTC 2023
    - 823 bytes
    - Viewed (0)
Back to top