diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 5c11966d44..229b92169e 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -768,6 +768,8 @@ proc fillObjectFields*(m: BModule; typ: PType) = # this fact here. var check = initIntSet() discard getRecordFields(m, typ, check) + if typ.baseClass != nil: + fillObjectFields(m, typ.baseClass.skipTypes(skipPtrs)) proc mangleDynLibProc(sym: PSym): Rope diff --git a/tests/objects/t24847.nim b/tests/objects/t24847.nim new file mode 100644 index 0000000000..667a4520fa --- /dev/null +++ b/tests/objects/t24847.nim @@ -0,0 +1,30 @@ +# issue #24847 + +block: # original issue test + type + R[C] = ref object of RootObj + b: C + K[S] = ref object of R[S] + W[J] = object + case y: bool + of false, true: discard + + proc e[T]() = discard K[T]() + iterator h(): int {.closure.} = e[W[int]]() + let _ = h + type U = distinct int + e[W[U]]() + +block: # simplified + type + R[C] = ref object of RootObj + b: C + K[S] = ref object of R[S] + W[J] = object + case y: bool + of false, true: discard + + type U = distinct int + + discard K[W[int]]() + discard K[W[U]]()