From b558a8a6596171712bf773625d2c056c1b2a44aa Mon Sep 17 00:00:00 2001 From: mertcandav Date: Sun, 30 Jun 2024 12:47:31 +0300 Subject: [PATCH] sema: caught genericed types for comptime::TypeOf function --- std/jule/sema/builtin.jule | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/std/jule/sema/builtin.jule b/std/jule/sema/builtin.jule index c162b181b..8576479cc 100644 --- a/std/jule/sema/builtin.jule +++ b/std/jule/sema/builtin.jule @@ -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, "") + if f != nil { + if f.IsBuiltin() { + e.pushErr(fc.Args[0].Token, LogMsg.InvalidTypeForTypeOf, "") + 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)