Skip to content

Commit

Permalink
sema: fix comparable constrait analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jun 26, 2024
1 parent b7cf7a7 commit 5f7b658
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions std/jule/sema/constrait.jule
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ fn matchConstraint(&c: str, mut &g: &TypeKind): bool {
| builtinConstraint.Immutable:
ret !g.Mutable()
| builtinConstraint.Comparable:
if g.Slc() != nil || g.Map() != nil || g.Fn() != nil {
ret false
}
let mut s = g.Struct()
if s != nil && !s.Comparable {
ret false
}
ret true
| builtinConstraint.Ordered:
ret g.Ordered()
Expand Down

0 comments on commit 5f7b658

Please sign in to comment.