Skip to content

Commit

Permalink
jule: only constant expressions allowed for default value of struct f…
Browse files Browse the repository at this point in the history
…ields
  • Loading branch information
mertcandav committed Jan 5, 2025
1 parent d698416 commit d3b4d63
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions std/jule/sema/sema.jule
Original file line number Diff line number Diff line change
Expand Up @@ -2340,6 +2340,11 @@ impl sema {
continue
}

if !f.Default.IsConst() {
self.pushErr(f.Decl.Default.Token, build::LogMsg.ExprNotConst)
continue
}

const Reference = false // Fields cannot be reference.
_ = self.checkAssignType(Reference, f.Type, f.Default, f.Decl.Default.Token, s.Refers)
}
Expand Down

0 comments on commit d3b4d63

Please sign in to comment.