Minor std/strscans improvements (#24566)

#### Removes UnInit warnings when using `scanTuple`

e.g. this would emit a warning
```nim
import std/strscans

proc main() =
  let (ok, number) = "123".scanTuple()
```

![image](https://github.com/user-attachments/assets/68170ac6-402d-48b0-b8b6-69e71f4b70ae)

#### 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

![image](https://github.com/user-attachments/assets/096e56d2-0eb5-4c67-9725-25caa97afebd)
now it returns

![image](https://github.com/user-attachments/assets/736a4292-2f56-4cf3-a27a-677045377171)

(cherry picked from commit 5b9ff963c5)
This commit is contained in:
Jake Leahy
2024-12-25 19:27:12 +11:00
committed by narimiran
parent b2f2b34fe5
commit 9e1b199e78
3 changed files with 14 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
discard """
errormsg: "type mismatch between pattern '$$i' (position: 1) and HourRange var 'hour'"
file: "strscans.nim"
file: "t8925.nim"
"""
import strscans

View File

@@ -0,0 +1,11 @@
discard """
cmd: "nim check $file"
"""
import std/strscans
block:
var strVar: string
discard "123".scanf("$i", strVar) #[tt.Error
^ type mismatch between pattern '$$i' (position: 1) and string var 'strVar']#