Skip to content

Commit

Permalink
sema: caught genericed types for comptime::TypeOf function
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jun 30, 2024
1 parent 83914ad commit b558a8a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions std/jule/sema/builtin.jule
Original file line number Diff line number Diff line change
Expand Up @@ -844,12 +844,23 @@ fn builtinCallerStdComptimeTypeOf(mut &e: &Eval, mut &fc: &FnCallExpr, mut &_: &
ret nil
}
let f = d.Kind.Fn()
if f != nil && f.IsBuiltin() {
e.pushErr(fc.Token, LogMsg.InvalidTypeForTypeOf, "<built-in fn>")
if f != nil {
if f.IsBuiltin() {
e.pushErr(fc.Args[0].Token, LogMsg.InvalidTypeForTypeOf, "<built-in fn>")
ret nil
}
if len(f.Generics) != len(f.Decl.Generics) {
e.pushErr(fc.Args[0].Token, LogMsg.HasGenerics)
ret nil
}
}
let s = d.Kind.Struct()
if s != nil && len(s.Generics) != len(s.Decl.Generics) {
e.pushErr(fc.Args[0].Token, LogMsg.HasGenerics)
ret nil
}
if d.Kind.comptime() {
e.pushErr(fc.Token, LogMsg.InvalidTypeForTypeOf, d.Kind.Str())
e.pushErr(fc.Args[0].Token, LogMsg.InvalidTypeForTypeOf, d.Kind.Str())
ret nil
}
ret buildComptimeTypeInfoData(e.s, d.Kind)
Expand Down

0 comments on commit b558a8a

Please sign in to comment.