commit b7a45029d5bc92077c38b3e419dcf58f20f7ef54
parent 9c44e3976bb94933813866027721e858782638ce
Author: Drew DeVault <sir@cmpwn.com>
Date: Fri, 3 Sep 2021 09:26:50 +0200
hare::types: handle aliases for is_*
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/hare/types/class.ha b/hare/types/class.ha
@@ -1,6 +1,8 @@
// Returns true if the given type is a signed type.
export fn is_signed(ty: const *_type) bool = {
return match (ty.repr) {
+ // TODO: al.secondary as *_type
+ al: alias => is_signed(al.secondary: const *_type),
bi: builtin => switch (bi) {
builtin::F32, builtin::F64,
builtin::I16, builtin::I32, builtin::I64, builtin::I8,
@@ -19,6 +21,8 @@ export fn is_signed(ty: const *_type) bool = {
// Returns true if the given type is a floating-point type.
export fn is_float(ty: const *_type) bool = {
return match (ty.repr) {
+ // TODO: al.secondary as *_type
+ al: alias => is_float(al.secondary: const *_type),
bi: builtin => switch (bi) {
builtin::F32, builtin::F64 => true,
* => false,
@@ -30,6 +34,8 @@ export fn is_float(ty: const *_type) bool = {
// Returns true if the given type is an integer type.
export fn is_integer(ty: const *_type) bool = {
return match (ty.repr) {
+ // TODO: al.secondary as *_type
+ al: alias => is_integer(al.secondary: const *_type),
bi: builtin => switch (bi) {
builtin::INT, builtin::UINT,
builtin::I16, builtin::I32, builtin::I64, builtin::I8,