Skip to content

Commit

Permalink
std::comptime: add enum support for the Elem method of comptimeTypeInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jun 26, 2024
1 parent 27f9a10 commit 58a6325
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion std/comptime/type.jule
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl comptimeTypeInfo {
fn Bits(self): int

// Returns comptimeTypeInfo for element type.
// Supports only pointers (except unsafe pointer), smart pointers, arrays, and slices.
// Supports only pointers (except unsafe pointer), smart pointers, arrays, slices, and enums.
fn Elem(self): comptimeTypeInfo

// Returns size of array.
Expand Down
4 changes: 4 additions & 0 deletions std/jule/sema/comptime.jule
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ impl comptimeType {
if array != nil {
ret buildComptimeTypeInfoData(e.s, array.Elem)
}
let mut enm = self.base.Enum()
if enm != nil {
ret buildComptimeTypeInfoData(e.s, enm.Kind.Kind)
}
e.pushErr(fc.Token, LogMsg.InvalidTypeForFn, self.base.Str(), "Elem")
ret nil
}
Expand Down

0 comments on commit 58a6325

Please sign in to comment.