compiler, reflect: add support for named types

This commit is contained in:
Damian Gryski
2023-02-28 16:09:00 -08:00
committed by Damian Gryski
parent 45f119de34
commit 7654d86d2c
4 changed files with 43 additions and 5 deletions
+10
View File
@@ -213,6 +213,16 @@ func TestBytes(t *testing.T) {
}
}
func TestNamedTypes(t *testing.T) {
type namedString string
named := namedString("foo")
if got, want := TypeOf(named).Name(), "namedString"; got != want {
t.Errorf("TypeOf.Name()=%v, want %v", got, want)
}
}
func equal[T comparable](a, b []T) bool {
if len(a) != len(b) {
return false