diff --git a/std/internal/fmt/format.jule b/std/internal/fmt/format.jule index b9ee09635..e991f1c55 100644 --- a/std/internal/fmt/format.jule +++ b/std/internal/fmt/format.jule @@ -83,7 +83,7 @@ fn FmtByDefault(mut &buf: str, &arg: any) { } } -fn applyFmtByDefault(mut &buf: str, mut &j: int, &args: ...any) { +fn applyFmtByDefault(mut &buf: str, mut &j: int, args: ...any) { let arg = args[j] j++ FmtByDefault(buf, arg) @@ -91,7 +91,7 @@ fn applyFmtByDefault(mut &buf: str, mut &j: int, &args: ...any) { // Returns result of formatting. // Parameter j is the position of argument list. -fn applyFmt(mut &fmt: []byte, mut &buf: str, mut &j: int, &args: ...any) { +fn applyFmt(mut &fmt: []byte, mut &buf: str, mut &j: int, args: ...any) { // {} if len(fmt) == 2 { applyFmtByDefault(buf, j, args...) diff --git a/std/jule/build/log.jule b/std/jule/build/log.jule index 61d60e689..4ae8509c8 100644 --- a/std/jule/build/log.jule +++ b/std/jule/build/log.jule @@ -89,6 +89,7 @@ enum LogMsg: str { VariadicParamNotLast: `variadic parameter can only be last parameter`, VariadicWithNonVariadicable: `type @ is not variadicable`, MoreArgsWithVariadiced: `variadic argument can't use with more argument`, + VariadicReference: `variadic storage cannot be reference`, TypeNotSupportsCasting: `type @ not supports casting`, TypeNotSupportsCastingTo: `type @ not supports casting to type @`, UseAtContent: `use declaration must be start of source code`, diff --git a/std/jule/sema/sema.jule b/std/jule/sema/sema.jule index 98c0cf481..1dd04a0c8 100644 --- a/std/jule/sema/sema.jule +++ b/std/jule/sema/sema.jule @@ -1520,6 +1520,17 @@ impl Sema { ret } + fn checkFnVariadicParam(mut &self, mut &f: &Fn): bool { + if len(f.Params) == 0 { + ret false + } + let mut param = f.Params[len(f.Params)-1] + if param.Variadic && param.Reference { + self.pushErr(param.Token, LogMsg.VariadicReference) + } + ret true + } + // Checks generics, parameters and return type. // Not checks scope, and other things. fn checkFnDeclPrototype(mut &self, mut &f: &Fn) { @@ -1540,6 +1551,7 @@ impl Sema { | !self.checkDeclGenerics(f.Generics): | !self.checkFnDeclParamsDup(f): | !self.checkFnDeclResultDup(f): + | !self.checkFnVariadicParam(f): } }