use typeof instead type (#16962)

This commit is contained in:
flywind 2021-02-08 02:46:07 -06:00 • committed by GitHub
commit d447c0fe3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 253 additions and 253 deletions

View file

@ -242,7 +242,7 @@ template addFrameEntry(s: var string, f: StackTraceEntry|PFrame) =
for k in 1..max(1, 25-(s.len-oldLen)): add(s, ' ')
add(s, f.procname)
when NimStackTraceMsgs:
when type(f) is StackTraceEntry:
when typeof(f) is StackTraceEntry:
add(s, f.frameMsg)
else:
var first = if f.prev == nil: 0 else: f.prev.frameMsgLen

View file

@ -240,7 +240,7 @@ iterator fields*[T: tuple|object](x: T): RootObj {.
## that affects symbol binding in the loop body.
runnableExamples:
var t = (1, "foo")
for v in fields(t): v = default(type(v))
for v in fields(t): v = default(typeof(v))
doAssert t == (0, "")
iterator fields*[S:tuple|object, T:tuple|object](x: S, y: T): tuple[key: string, val: RootObj] {.
@ -252,7 +252,7 @@ iterator fields*[S:tuple|object, T:tuple|object](x: S, y: T): tuple[key: string,
## in the loop body.
runnableExamples:
var t1 = (1, "foo")
var t2 = default(type(t1))
var t2 = default(typeof(t1))
for v1, v2 in fields(t1, t2): v2 = v1
doAssert t1 == t2