Skip to content

Commit

Permalink
sema: fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Jun 20, 2024
1 parent 7f2a67f commit 97c03aa
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 67 deletions.
2 changes: 1 addition & 1 deletion std/jule/sema/directive.jule
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl directiveChecker {

if len(d.Args) == 0 {
self.s.pushErr(d.Tag, LogMsg.MissingExpr)
self.s.pushSugggestion(LogMsg.ExpectedIdentifier)
self.s.pushSuggestion(LogMsg.ExpectedIdentifier)
ret
} else if len(d.Args) > 1 {
self.s.pushErr(d.Args[1], LogMsg.ArgumentOverflow, "derive")
Expand Down
42 changes: 21 additions & 21 deletions std/jule/sema/eval.jule
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ impl Eval {
}

// Push suggestion to last log.
fn pushSugggestion(mut self, fmt: LogMsg, args: ...any) {
self.s.pushSugggestion(fmt, args...)
fn pushSuggestion(mut self, fmt: LogMsg, args: ...any) {
self.s.pushSuggestion(fmt, args...)
}

fn allowBuiltin(mut self) {
Expand Down Expand Up @@ -322,7 +322,7 @@ impl Eval {
} else {
let unsig = conv::ParseUint(lit, base, BitSize) else {
self.pushErr(l.Token, LogMsg.InvalidNumericRange)
self.pushSugggestion(LogMsg.TryFloatingPoint)
self.pushSuggestion(LogMsg.TryFloatingPoint)
use u64.Max
}
d.Constant = Const.NewU64(unsig)
Expand Down Expand Up @@ -459,7 +459,7 @@ impl Eval {
fn evalEnum(mut self, mut enm: &Enum, errorToken: &Token): &Data {
if !self.s.isAccessibleDefine(enm.Public, enm.Token) {
self.pushErr(errorToken, LogMsg.IdentIsNotAccessible, enm.Ident)
self.pushSugggestion(LogMsg.MakePubToAccess)
self.pushSuggestion(LogMsg.MakePubToAccess)
ret nil
}
ret self._evalEnum(enm)
Expand All @@ -477,7 +477,7 @@ impl Eval {
fn evalTypeEnum(mut self, mut enm: &TypeEnum, errorToken: &Token): &Data {
if !self.s.isAccessibleDefine(enm.Public, enm.Token) {
self.pushErr(errorToken, LogMsg.IdentIsNotAccessible, enm.Ident)
self.pushSugggestion(LogMsg.MakePubToAccess)
self.pushSuggestion(LogMsg.MakePubToAccess)
ret nil
}
ret self._evalTypeEnum(enm)
Expand All @@ -500,7 +500,7 @@ impl Eval {
fn evalStruct(mut self, mut s: &StructIns, errorToken: &Token): &Data {
if !self.s.isAccessibleDefine(s.Decl.Public, s.Decl.Token) {
self.pushErr(errorToken, LogMsg.IdentIsNotAccessible, s.Decl.Ident)
self.pushSugggestion(LogMsg.MakePubToAccess)
self.pushSuggestion(LogMsg.MakePubToAccess)
ret nil
}
self.checkDeprecated(s.Decl.Directives, errorToken)
Expand Down Expand Up @@ -528,14 +528,14 @@ impl Eval {
} else {
self.pushErr(tok, LogMsg.UsingDeprecated, d.Args[0].Kind)
}
self.pushSugggestion(LogMsg.UseUnsafeForDeprecated)
self.pushSuggestion(LogMsg.UseUnsafeForDeprecated)
}
}

fn evalFn(mut self, mut f: &Fn, errorToken: &Token): &Data {
if !self.s.isAccessibleDefine(f.Public, f.Token) {
self.pushErr(errorToken, LogMsg.IdentIsNotAccessible, f.Ident)
self.pushSugggestion(LogMsg.MakePubToAccess)
self.pushSuggestion(LogMsg.MakePubToAccess)
ret nil
}

Expand Down Expand Up @@ -601,7 +601,7 @@ impl Eval {
fn evalVar(mut self, mut v: &Var, errorToken: &Token): &Data {
if !self.s.isAccessibleDefine(v.Public, v.Token) {
self.pushErr(errorToken, LogMsg.IdentIsNotAccessible, v.Ident)
self.pushSugggestion(LogMsg.MakePubToAccess)
self.pushSuggestion(LogMsg.MakePubToAccess)
ret nil
}

Expand Down Expand Up @@ -690,7 +690,7 @@ impl Eval {
fn evalTypeAlias(mut self, mut ta: &TypeAlias, errorToken: &Token): &Data {
if !self.s.isAccessibleDefine(ta.Public, ta.Token) {
self.pushErr(errorToken, LogMsg.IdentIsNotAccessible, ta.Ident)
self.pushSugggestion(LogMsg.MakePubToAccess)
self.pushSuggestion(LogMsg.MakePubToAccess)
ret nil
}

Expand Down Expand Up @@ -1686,7 +1686,7 @@ impl Eval {
| d.Kind.Prim() != nil && d.Kind.Prim().IsAny():
if t.Enum() != nil {
self.pushErr(errorToken, LogMsg.EnumCastedFromAny)
self.pushSugggestion(LogMsg.CastToEnumTypeInsteadOfEnum)
self.pushSuggestion(LogMsg.CastToEnumTypeInsteadOfEnum)
} else if t.TypeEnum() != nil {
self.pushErr(errorToken, LogMsg.EnumCastedFromAny)
}
Expand Down Expand Up @@ -1913,12 +1913,12 @@ impl Eval {
if p.Decl.IsSelf() {
if !p.Decl.IsRef() {
self.pushErr(errorToken, LogMsg.ConcurrentCallWithSelfParam)
self.pushSugggestion(LogMsg.UseUnsafeJuleToCallCoSelf)
self.pushSuggestion(LogMsg.UseUnsafeJuleToCallCoSelf)
}
}
if p.Decl.Reference {
self.pushErr(errorToken, LogMsg.ConcurrentCallWithRefParam)
self.pushSugggestion(LogMsg.UseUnsafeJuleToCallCo)
self.pushSuggestion(LogMsg.UseUnsafeJuleToCallCo)
ret
}
}
Expand Down Expand Up @@ -1959,7 +1959,7 @@ impl Eval {
}
if self.isGlobal() && f.Decl.Exceptional {
self.pushErr(fc.Token, LogMsg.ExceptionalAtGlobalScope)
self.pushSugggestion(LogMsg.WrapExceptional)
self.pushSuggestion(LogMsg.WrapExceptional)
d = nil
ret
}
Expand Down Expand Up @@ -2067,12 +2067,12 @@ impl Eval {
if f.Decl.Exceptional {
if fc.IsCo {
self.s.pushErr(fc.Token, LogMsg.CoForExceptional)
self.s.pushSugggestion(LogMsg.HandleInFn)
self.s.pushSuggestion(LogMsg.HandleInFn)
}
match {
| fc.Unhandled():
self.pushErr(fc.Token, LogMsg.UnhandledExceptional)
self.pushSugggestion(LogMsg.HandleExceptional)
self.pushSuggestion(LogMsg.HandleExceptional)
| fc.Ignored():
// Ok.
break
Expand Down Expand Up @@ -2173,7 +2173,7 @@ impl Eval {
if method != nil {
if !self.s.isAccessibleDefine(method.Public, method.Token) {
self.pushErr(ident, LogMsg.IdentIsNotAccessible, ident.Kind)
self.pushSugggestion(LogMsg.MakePubToAccess)
self.pushSuggestion(LogMsg.MakePubToAccess)
}

let mut ins = method.instance()
Expand Down Expand Up @@ -2223,7 +2223,7 @@ impl Eval {
if f != nil {
if !self.s.isAccessibleDefine(f.Decl.Public, f.Decl.Token) {
self.pushErr(si.Ident, LogMsg.IdentIsNotAccessible, f.Decl.Ident)
self.pushSugggestion(LogMsg.MakePubToAccess)
self.pushSuggestion(LogMsg.MakePubToAccess)
}

let mut model = &StructSubIdentExprModel{
Expand Down Expand Up @@ -2256,7 +2256,7 @@ impl Eval {
}
if !self.s.isAccessibleDefine(m.Public, m.Token) {
self.pushErr(si.Ident, LogMsg.IdentIsNotAccessible, m.Ident)
self.pushSugggestion(LogMsg.MakePubToAccess)
self.pushSuggestion(LogMsg.MakePubToAccess)
}

if m.Params[0].IsRef() && !ref {
Expand Down Expand Up @@ -3392,7 +3392,7 @@ impl binaryEval {
}
err:
self.e.pushErr(self.op, LogMsg.AmperOpForEnum, enm.Ident, self.op.Kind)
self.e.pushSugggestion(LogMsg.DefineZeroDefaultToUseAmper)
self.e.pushSuggestion(LogMsg.DefineZeroDefaultToUseAmper)
next:
fall
| TokenKind.Vline
Expand Down Expand Up @@ -4108,7 +4108,7 @@ impl binaryEval {
fn eval(mut self, mut &op: &BinopExpr): &Data {
if op.Op.Kind == TokenKind.Eq {
self.e.pushErr(op.Op, LogMsg.AssignInExpr)
self.e.pushSugggestion(LogMsg.UseImperative)
self.e.pushSuggestion(LogMsg.UseImperative)
ret nil
}

Expand Down
20 changes: 10 additions & 10 deletions std/jule/sema/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ fn checkAssign(mut &s: &Sema, mut &left: &Data, mut right: &Data, op: &Token): (
match {
| left.IsConst():
s.pushErr(op, LogMsg.AssignConst)
s.pushSugggestion(LogMsg.RemoveConstToAssign)
s.pushSuggestion(LogMsg.RemoveConstToAssign)
ret false
| !left.Lvalue:
s.pushErr(op, LogMsg.AssignRequireLvalue)
Expand Down Expand Up @@ -710,7 +710,7 @@ impl scopeChecker {

if self.isDuplicatedIdent(uintptr(v), v.Ident) {
self.s.pushErr(v.Token, LogMsg.DuplicatedIdent, v.Ident)
self.s.pushSugggestion(LogMsg.RenameForAvoidDuplication)
self.s.pushSuggestion(LogMsg.RenameForAvoidDuplication)
self.stop()
ret
}
Expand All @@ -727,7 +727,7 @@ impl scopeChecker {
let mut ta = buildTypeAlias(decl)
if self.isDuplicatedIdent(uintptr(ta), ta.Ident) {
self.s.pushErr(ta.Token, LogMsg.DuplicatedIdent, ta.Ident)
self.s.pushSugggestion(LogMsg.RenameForAvoidDuplication)
self.s.pushSuggestion(LogMsg.RenameForAvoidDuplication)
self.stop()
ret
}
Expand Down Expand Up @@ -776,7 +776,7 @@ impl scopeChecker {
let mut root = self.getRoot()
if !root.owner.Decl.Exceptional {
self.s.pushErr(err, LogMsg.ErrorWithNonExceptional)
self.s.pushSugggestion(LogMsg.DeclareExceptional)
self.s.pushSuggestion(LogMsg.DeclareExceptional)
}
m.Func = root.owner
}
Expand Down Expand Up @@ -956,7 +956,7 @@ impl scopeChecker {
if kind.KeyA != nil {
if !self.s.isFlag(SemaFlag.Shadowing) && self.isDuplicatedIdent(0, kind.KeyA.Ident) {
self.s.pushErr(kind.KeyA.Token, LogMsg.DuplicatedIdent, kind.KeyA.Ident)
self.s.pushSugggestion(LogMsg.RenameForAvoidDuplication)
self.s.pushSuggestion(LogMsg.RenameForAvoidDuplication)
}
kind.KeyA.Scope = scope
ssc.table.Vars = append(ssc.table.Vars, kind.KeyA)
Expand All @@ -965,7 +965,7 @@ impl scopeChecker {
if kind.KeyB != nil {
if !self.s.isFlag(SemaFlag.Shadowing) && self.isDuplicatedIdent(0, kind.KeyB.Ident) {
self.s.pushErr(kind.KeyB.Token, LogMsg.DuplicatedIdent, kind.KeyB.Ident)
self.s.pushSugggestion(LogMsg.RenameForAvoidDuplication)
self.s.pushSuggestion(LogMsg.RenameForAvoidDuplication)
}
kind.KeyB.Scope = scope
ssc.table.Vars = append(ssc.table.Vars, kind.KeyB)
Expand Down Expand Up @@ -1303,7 +1303,7 @@ impl scopeChecker {
if a.Declarative && (lexpr.Reference || self.isNewAssignIdent(lexpr.Ident)) {
if self.isDuplicatedIdent(0, lexpr.Ident) {
self.s.pushErr(lexpr.Token, LogMsg.DuplicatedIdent, lexpr.Ident)
self.s.pushSugggestion(LogMsg.RenameForAvoidDuplication)
self.s.pushSuggestion(LogMsg.RenameForAvoidDuplication)
self.stop()
ret
}
Expand Down Expand Up @@ -1343,7 +1343,7 @@ impl scopeChecker {

if lexpr.Mutable || lexpr.Reference {
self.s.pushErr(lexpr.Token, LogMsg.DuplicatedIdent, lexpr.Ident)
self.s.pushSugggestion(LogMsg.RenameForAvoidDuplication)
self.s.pushSuggestion(LogMsg.RenameForAvoidDuplication)
}

if !checkAssign(self.s, l, r, a.Setter) {
Expand Down Expand Up @@ -1462,7 +1462,7 @@ impl scopeChecker {

if d.Decl {
self.s.pushErr(e.Token, LogMsg.DeclFoundInsteadExpr)
self.s.pushSugggestion(LogMsg.UseTypeMatch)
self.s.pushSuggestion(LogMsg.UseTypeMatch)
continue
}

Expand Down Expand Up @@ -1630,7 +1630,7 @@ impl scopeChecker {
let mut case = unsafe { (*Case)(self.cse) }
if unsafe { case.Next } == nil {
self.s.pushErr(f.Token, LogMsg.FallthroughIntoFinalCase)
self.s.pushSugggestion(LogMsg.RemoveFallthroughFromFinalCase)
self.s.pushSuggestion(LogMsg.RemoveFallthroughFromFinalCase)
ret
}

Expand Down
Loading

0 comments on commit 97c03aa

Please sign in to comment.