Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 14 for isAlias (0.1 sec)

  1. src/go/types/object_test.go

    import (
    	"fmt"
    	"internal/testenv"
    	"strings"
    	"testing"
    
    	. "go/types"
    )
    
    func TestIsAlias(t *testing.T) {
    	check := func(obj *TypeName, want bool) {
    		if got := obj.IsAlias(); got != want {
    			t.Errorf("%v: got IsAlias = %v; want %v", obj, got, want)
    		}
    	}
    
    	// predeclared types
    	check(Unsafe.Scope().Lookup("Pointer").(*TypeName), false)
    	for _, name := range Universe.Names() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 14:10:44 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/types2/object_test.go

    	"fmt"
    	"internal/testenv"
    	"strings"
    	"testing"
    
    	. "cmd/compile/internal/types2"
    )
    
    func TestIsAlias(t *testing.T) {
    	check := func(obj *TypeName, want bool) {
    		if got := obj.IsAlias(); got != want {
    			t.Errorf("%v: got IsAlias = %v; want %v", obj, got, want)
    		}
    	}
    
    	// predeclared types
    	check(Unsafe.Scope().Lookup("Pointer").(*TypeName), false)
    	for _, name := range Universe.Names() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 18 14:10:44 UTC 2024
    - 5.2K bytes
    - Viewed (0)
  3. src/go/types/object.go

    	obj := NewTypeName(pos, pkg, name, nil)
    	NewNamed(obj, nil, nil).loader = load
    	return obj
    }
    
    // IsAlias reports whether obj is an alias name for a type.
    func (obj *TypeName) IsAlias() bool {
    	switch t := obj.typ.(type) {
    	case nil:
    		return false
    	// case *Alias:
    	//	handled by default case
    	case *Basic:
    		// unsafe.Pointer is not an alias.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 20:08:23 UTC 2024
    - 20.1K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/types2/object.go

    	obj := NewTypeName(pos, pkg, name, nil)
    	NewNamed(obj, nil, nil).loader = load
    	return obj
    }
    
    // IsAlias reports whether obj is an alias name for a type.
    func (obj *TypeName) IsAlias() bool {
    	switch t := obj.typ.(type) {
    	case nil:
    		return false
    	// case *Alias:
    	//	handled by default case
    	case *Basic:
    		// unsafe.Pointer is not an alias.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 20:08:23 UTC 2024
    - 20.1K bytes
    - Viewed (0)
  5. src/go/types/decl.go

    			// this information explicitly in the object.
    			var alias bool
    			if check.conf._EnableAlias {
    				alias = obj.IsAlias()
    			} else {
    				if d := check.objMap[obj]; d != nil {
    					alias = d.tdecl.Assign.IsValid() // package-level object
    				} else {
    					alias = obj.IsAlias() // function local object
    				}
    			}
    			if !alias {
    				ndef++
    			}
    		case *Func:
    			// ignored for now
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 31K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/types2/decl.go

    			// this information explicitly in the object.
    			var alias bool
    			if check.conf.EnableAlias {
    				alias = obj.IsAlias()
    			} else {
    				if d := check.objMap[obj]; d != nil {
    					alias = d.tdecl.Alias // package-level object
    				} else {
    					alias = obj.IsAlias() // function local object
    				}
    			}
    			if !alias {
    				ndef++
    			}
    		case *Func:
    			// ignored for now
    		default:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 29.6K bytes
    - Viewed (0)
  7. src/go/types/mono.go

    	// parameters that it's implicitly parameterized by.
    	for scope := obj.Parent(); scope != root; scope = scope.Parent() {
    		for _, elem := range scope.elems {
    			if elem, ok := elem.(*TypeName); ok && !elem.IsAlias() && cmpPos(elem.Pos(), obj.Pos()) < 0 {
    				if tpar, ok := elem.Type().(*TypeParam); ok {
    					if idx < 0 {
    						idx = len(w.vertices)
    						w.vertices = append(w.vertices, monoVertex{obj: obj})
    					}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 9.2K bytes
    - Viewed (0)
  8. src/cmd/compile/internal/types2/predicates.go

    	}
    
    	switch x := x.(type) {
    	case *Basic:
    		// Basic types are singletons except for the rune and byte
    		// aliases, thus we cannot solely rely on the x == y check
    		// above. See also comment in TypeName.IsAlias.
    		if y, ok := y.(*Basic); ok {
    			return x.kind == y.kind
    		}
    
    	case *Array:
    		// Two array types are identical if they have identical element types
    		// and the same array length.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 17.5K bytes
    - Viewed (0)
  9. src/go/types/predicates.go

    	}
    
    	switch x := x.(type) {
    	case *Basic:
    		// Basic types are singletons except for the rune and byte
    		// aliases, thus we cannot solely rely on the x == y check
    		// above. See also comment in TypeName.IsAlias.
    		if y, ok := y.(*Basic); ok {
    			return x.kind == y.kind
    		}
    
    	case *Array:
    		// Two array types are identical if they have identical element types
    		// and the same array length.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 17.6K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go

    		tname, ok := o.(*types.TypeName)
    		if !ok {
    			continue // handle non-types in second pass
    		}
    
    		path := append(empty, o.Name()...)
    		path = append(path, opType)
    
    		T := o.Type()
    
    		if tname.IsAlias() {
    			// type alias
    			if r := find(obj, T, path, nil); r != nil {
    				return Path(r), nil
    			}
    		} else {
    			if named, _ := T.(*types.Named); named != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 23.1K bytes
    - Viewed (0)
Back to top