diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 4c1a1b4cb3289..d6450dbc1bf55 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -268,6 +268,17 @@ proc hasValuelessStatics(n: PNode): bool = if hasValuelessStatics(x): return true +proc resetTypeTestPath(n: PNode): bool = + # `mIs` is resolved during semantic checking. Reset cached types along the + # path so nested type tests are checked again after generic substitution. + result = n.kind in nkCallKinds and n[0].kind == nkSym and + n[0].sym.magic == mIs + for i in ord(n.kind in nkCallKinds)..