- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 138 for generic (0.08 sec)
-
src/cmd/compile/internal/types2/api_predicates.go
// uninstantiated generic type. func ConvertibleTo(V, T Type) bool { x := operand{mode: value, typ: V} return x.convertibleTo(nil, T, nil) // check not needed for non-constant x } // Implements reports whether type V implements interface T. // // The behavior of Implements is unspecified if V is Typ[Invalid] or an uninstantiated // generic type. func Implements(V Type, T *Interface) bool {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Apr 08 16:36:08 UTC 2024 - 3.3K bytes - Viewed (0) -
src/cmd/compile/internal/test/issue50182_test.go
// Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package test import ( "fmt" "sort" "testing" ) // Test that calling methods on generic types doesn't cause allocations. func genericSorted[T sort.Interface](data T) bool { n := data.Len() for i := n - 1; i > 0; i-- { if data.Less(i, i-1) { return false } } return true }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Jan 13 23:35:37 UTC 2022 - 1.2K bytes - Viewed (0) -
src/cmd/compile/internal/types2/alias.go
func (a *Alias) Underlying() Type { return unalias(a).Underlying() } // Origin returns the generic Alias type of which a is an instance. // If a is not an instance of a generic alias, Origin returns a. func (a *Alias) Origin() *Alias { return a.orig } // TypeParams returns the type parameters of the alias type a, or nil. // A generic Alias and its instances have the same type parameters.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 03:01:18 UTC 2024 - 5K bytes - Viewed (0) -
src/cmd/compile/internal/ssa/compile.go
{"dse", "insert resched checks"}, // insert resched checks adds new blocks containing generic instructions {"insert resched checks", "lower"}, {"insert resched checks", "tighten"}, // prove relies on common-subexpression elimination for maximum benefits. {"generic cse", "prove"}, // deadcode after prove to eliminate all new dead blocks. {"prove", "generic deadcode"}, // common-subexpression before dead-store elim, so that we recognize
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Apr 22 14:55:18 UTC 2024 - 18.6K bytes - Viewed (0) -
src/cmd/compile/internal/ssa/_gen/decOps.go
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Oct 04 19:35:46 UTC 2022 - 355 bytes - Viewed (0) -
src/cmd/compile/internal/types2/typexpr.go
typ := check.typInternal(e, def) assert(isTyped(typ)) if isGeneric(typ) { check.errorf(e, WrongTypeArgCount, "cannot use generic type %s without instantiation", typ) typ = Typ[Invalid] } check.recordTypeAndValue(e, typexpr, typ, nil) return typ } // genericType is like typ but the type must be an (uninstantiated) generic // type. If cause is non-nil and the type expression was a valid type but not
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 30 19:19:55 UTC 2024 - 16.6K bytes - Viewed (0) -
src/cmd/compile/internal/types2/decl.go
nval := 0 // number of (constant or variable) values in the cycle; valid if !generic ndef := 0 // number of type definitions in the cycle; valid if !generic loop: for _, obj := range cycle { switch obj := obj.(type) { case *Const, *Var: nval++ case *TypeName: // If we reach a generic type that is part of a cycle // and we are in a type parameter list, we have a cycle
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 30 19:19:55 UTC 2024 - 29.6K bytes - Viewed (0) -
src/cmd/compile/internal/test/testdata/ptrsort.go
package main // Test generic sort function with two different pointer types in different packages, // make sure only one instantiation is created. import ( "fmt" "cmd/compile/internal/test/testdata/mysort" ) type MyString struct { string } func (a *MyString) Less(b *MyString) bool { return a.string < b.string } func main() { mysort.F() sl1 := []*mysort.MyInt{{7}, {1}, {4}, {6}} mysort.Sort(sl1)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Feb 16 19:10:58 UTC 2022 - 633 bytes - Viewed (0) -
src/cmd/compile/internal/types2/instantiate.go
if sig == orig { copy := *sig sig = © } // After instantiating a generic signature, it is not generic // anymore; we need to set tparams to nil. sig.tparams = nil res = sig default: // only types and functions can be generic panic(fmt.Sprintf("%v: cannot instantiate %v", pos, orig)) } // Update all contexts; it's possible that we've lost a race.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 03:01:18 UTC 2024 - 12.7K bytes - Viewed (0) -
src/cmd/compile/internal/types2/infer.go
// t0 was simplified to t1. // If t0 was a generic function, but the simplified signature t1 does // not contain any type parameters anymore, the function is not generic // anymore. Remove it's type parameters. (go.dev/issue/59953) // Note that if t0 was a signature, t1 must be a signature, and t1 // can only be a generic signature if it originated from a generic
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 24 13:54:20 UTC 2024 - 26.4K bytes - Viewed (0)