ssa: type uint/byte/int32/uint32/int64/uint64

This commit is contained in:
visualfc
2024-05-17 09:28:57 +08:00
parent 1cfe3ee9f8
commit f35f15d36c
3 changed files with 88 additions and 9 deletions

View File

@@ -461,3 +461,28 @@ _llgo_0:
}
`)
}
func TestBasicType(t *testing.T) {
type typeInfo struct {
typ Type
kind types.BasicKind
}
prog := NewProgram(nil)
infos := []*typeInfo{
{prog.Bool(), types.Bool},
{prog.Byte(), types.Byte},
{prog.Int(), types.Int},
{prog.Uint(), types.Uint},
{prog.Int32(), types.Int32},
{prog.Int64(), types.Int64},
{prog.Uint32(), types.Uint32},
{prog.Uint64(), types.Uint64},
{prog.Uintptr(), types.Uintptr},
{prog.VoidPtr(), types.UnsafePointer},
}
for _, info := range infos {
if info.typ.RawType() != types.Typ[info.kind] {
t.Fatal("bad type", info)
}
}
}