Skip to content

Commit

Permalink
sema: fix generic type alias eval
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Mar 13, 2024
1 parent 1eb6d8d commit ab9c72a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
11 changes: 6 additions & 5 deletions std/jule/sema/eval.jule
Original file line number Diff line number Diff line change
Expand Up @@ -690,23 +690,24 @@ impl Eval {
ta.used = true

let mut kind = ta.kind.kind.kind
let mut d: &Data = nil
match type kind {
| &StructIns:
ret self.__eval_struct((&StructIns)(kind))
d = self.__eval_struct((&StructIns)(kind))
| &Enum:
ret self.__eval_enum((&Enum)(kind))
d = self.__eval_enum((&Enum)(kind))
|:
let mut d = &Data{
d = &Data{
decl: true,
kind: &TypeKind{
generic: ta.generic,
cpp_ident: if ta.cpp_linked { ta.ident } else { ta.kind.kind.cpp_ident },
kind: ta.kind.kind.kind,
},
}
d.model = d.kind
ret d
}
d.kind.generic = ta.generic
ret d
}

fn eval_def(mut self, mut def: any, ident: Token): &Data {
Expand Down
2 changes: 1 addition & 1 deletion std/jule/sema/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ impl ScopeChecker {
let mut d = eval.eval_expr_kind(e.kind)
if d == nil {
continue
}
}
if m.type_match {
_case.exprs = append(_case.exprs, d)
if count_match_type(m, d.kind) > 1 {
Expand Down
8 changes: 6 additions & 2 deletions std/jule/sema/sema.jule
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ fn build_generic_type_aliases(mut &f: &FnIns): []&TypeAlias {
scope: f.decl.scope,
ident: decl.ident,
token: decl.token,
kind: &TypeSymbol{kind: g},
kind: &TypeSymbol{
kind: g,
},
})
}

Expand All @@ -193,7 +195,9 @@ fn build_generic_type_aliases(mut &f: &FnIns): []&TypeAlias {
scope: f.decl.scope,
ident: decl.ident,
token: decl.token,
kind: &TypeSymbol{kind: g},
kind: &TypeSymbol{
kind: g,
},
})
}
}
Expand Down

0 comments on commit ab9c72a

Please sign in to comment.