mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
#### Removes UnInit warnings when using `scanTuple`
e.g. this would emit a warning
```nim
import std/strscans
proc main() =
let (ok, number) = "123".scanTuple()
```

#### Error for wrong type now points to the passed in variable
```nim
import std/strscans
var str: string
discard "123".scanf("$i", str)
```
it gave this warning before

now it returns

(cherry picked from commit 5b9ff963c5)
17 lines
258 B
Nim
17 lines
258 B
Nim
discard """
|
|
errormsg: "type mismatch between pattern '$$i' (position: 1) and HourRange var 'hour'"
|
|
file: "t8925.nim"
|
|
"""
|
|
|
|
import strscans
|
|
|
|
type
|
|
HourRange = range[0..23]
|
|
|
|
var
|
|
hour: HourRange
|
|
timeStr: string
|
|
|
|
if scanf(timeStr, "$i", hour):
|
|
discard
|