Skip to content

Commit

Permalink
support alias types in typeIdentical() (#478)
Browse files Browse the repository at this point in the history
This is a possible implementation of types.Type as of Go 1.22, and gets created by default starting in Go 1.23.
  • Loading branch information
reillywatson authored Aug 15, 2024
1 parent 173c282 commit 5a36c24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/xtypes/xtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ func typeIdentical(x, y types.Type, p *ifacePair) bool {
case *typeparams.TypeParam:
// nothing to do (x and y being equal is caught in the very beginning of this function)

case *types.Alias:
// an alias type is identical if the type it's an alias of is identical to it.
return typeIdentical(x.Rhs(), y, p)

Check failure on line 226 in internal/xtypes/xtypes.go

View workflow job for this annotation

GitHub Actions / Build (oldstable)

x.Rhs undefined (type *types.Alias has no field or method Rhs) (typecheck)

Check failure on line 226 in internal/xtypes/xtypes.go

View workflow job for this annotation

GitHub Actions / Build (oldstable)

x.Rhs undefined (type *types.Alias has no field or method Rhs)) (typecheck)

Check failure on line 226 in internal/xtypes/xtypes.go

View workflow job for this annotation

GitHub Actions / Build (oldstable)

x.Rhs undefined (type *types.Alias has no field or method Rhs)) (typecheck)

case nil:
// avoid a crash in case of nil type

Expand Down

0 comments on commit 5a36c24

Please sign in to comment.