Skip to content

Commit 10ca7b4

Browse files
committed
Fix the Identical
1 parent 49e0217 commit 10ca7b4

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

check.go

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,10 @@ import (
44
"strings"
55
)
66

7-
// Equal Reports whether the type type is equal
7+
// Equal Reports whether the type is equal
8+
// Deprecated: should use Identical instead.
89
func Equal(t0 Type, t1 Type) bool {
9-
if t0.PkgPath() != t1.PkgPath() {
10-
return false
11-
}
12-
n0 := t0.Name()
13-
n1 := t1.Name()
14-
if n0 != n1 {
15-
return false
16-
}
17-
if n0 == "" {
18-
return Identical(t0, t1)
19-
}
20-
return true
10+
return Identical(t0, t1)
2111
}
2212

2313
// Implements reports whether type inter implements interface t.
@@ -72,6 +62,9 @@ func identical(t0, t1 Type, cmpTags bool) bool {
7262
if t0 == t1 {
7363
return true
7464
}
65+
if t0.PkgPath() == t1.PkgPath() && t0.Name() == t1.Name() {
66+
return true
67+
}
7568
k0 := t0.Kind()
7669
k1 := t1.Kind()
7770
if k0 != k1 {

0 commit comments

Comments
 (0)