github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/types/identity.go (about)

     1  // Copyright 2018 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 types
     6  
     7  // Identical reports whether t1 and t2 are identical types, following the spec rules.
     8  // Receiver parameter types are ignored. Named (defined) types are only equal if they
     9  // are pointer-equal - i.e. there must be a unique types.Type for each specific named
    10  // type. Also, a type containing a shape type is considered identical to another type
    11  // (shape or not) if their underlying types are the same, or they are both pointers.
    12  func Identical(t1, t2 *Type) bool
    13  
    14  // IdenticalIgnoreTags is like Identical, but it ignores struct tags
    15  // for struct identity.
    16  func IdenticalIgnoreTags(t1, t2 *Type) bool
    17  
    18  // IdenticalStrict is like Identical, but matches types exactly, without the
    19  // exception for shapes.
    20  func IdenticalStrict(t1, t2 *Type) bool