avoid Nim 2.0 issue when loading config (#5202)
To avoid Nim 2.0 issue https://github.com/nim-lang/Nim/issues/22284, explicitly specify `ref SecondarySources` instead of using `auto`, and add `{.raises.}` annotation
This commit is contained in:
parent
3eb1729d15
commit
da5bb96856
|
@ -201,7 +201,7 @@ template makeBannerAndConfig*(clientId: string, ConfType: type): untyped =
|
|||
version = version, # but a short version string makes more sense...
|
||||
copyrightBanner = clientId,
|
||||
secondarySources = proc (
|
||||
config: ConfType, sources: auto
|
||||
config: ConfType, sources: ref SecondarySources
|
||||
) {.raises: [ConfigurationError].} =
|
||||
if config.configFile.isSome:
|
||||
sources.addConfigFile(Toml, config.configFile.get)
|
||||
|
|
|
@ -82,6 +82,8 @@ proc main(flags: CliFlags) {.async.} =
|
|||
|
||||
waitFor main(
|
||||
load(CliFlags,
|
||||
secondarySources = proc (config: CliFlags, sources: auto) =
|
||||
secondarySources = proc (
|
||||
config: CliFlags, sources: ref SecondarySources
|
||||
) {.raises: [ConfigurationError].} =
|
||||
if config.configFile.isSome:
|
||||
sources.addConfigFile(Toml, config.configFile.get)))
|
||||
|
|
|
@ -21,7 +21,9 @@ type
|
|||
proc loadExampleConfig(content: string, cmdLine = newSeq[string]()): ExampleConfigFile =
|
||||
ExampleConfigFile.load(
|
||||
cmdLine = cmdLine,
|
||||
secondarySources = proc (config: ExampleConfigFile, sources: auto) =
|
||||
secondarySources = proc (
|
||||
config: ExampleConfigFile, sources: ref SecondarySources
|
||||
) {.raises: [ConfigurationError].} =
|
||||
sources.addConfigFileContent(Toml, content))
|
||||
|
||||
const
|
||||
|
|
Loading…
Reference in New Issue