mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
Merge pull request #8937 from Vindaar/fixes-8925
fix #8925 by using `getTypeInst` instead of `getType`
This commit is contained in:
@@ -317,8 +317,8 @@ macro scanf*(input: string; pattern: static[string]; results: varargs[typed]): b
|
||||
|
||||
template at(s: string; i: int): char = (if i < s.len: s[i] else: '\0')
|
||||
template matchError() =
|
||||
error("type mismatch between pattern '$" & pattern[p] & "' (position: " & $p & ") and " & repr(getType(results[i])) &
|
||||
" var '" & repr(results[i]) & "'")
|
||||
error("type mismatch between pattern '$" & pattern[p] & "' (position: " & $p &
|
||||
") and " & $getTypeInst(results[i]) & " var '" & repr(results[i]) & "'")
|
||||
|
||||
var i = 0
|
||||
var p = 0
|
||||
|
||||
16
tests/stdlib/t8925.nim
Normal file
16
tests/stdlib/t8925.nim
Normal file
@@ -0,0 +1,16 @@
|
||||
discard """
|
||||
file: "strscans.nim"
|
||||
errormsg: "type mismatch between pattern '$i' (position: 1) and HourRange var 'hour'"
|
||||
"""
|
||||
|
||||
import strscans
|
||||
|
||||
type
|
||||
HourRange = range[0..23]
|
||||
|
||||
var
|
||||
hour: HourRange
|
||||
timeStr: string
|
||||
|
||||
if scanf(timeStr, "$i", hour):
|
||||
discard
|
||||
Reference in New Issue
Block a user