From 3605203937d3d4246279ceeb89707a2ff61fd991 Mon Sep 17 00:00:00 2001 From: hlaaftana <10591326+hlaaftana@users.noreply.github.com> Date: Sat, 25 Jan 2020 14:48:37 +0300 Subject: [PATCH 1/2] Clearer final objects error fixes #13256 --- compiler/semtypes.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 2dcee1420eae8..735fc079619d3 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -851,7 +851,7 @@ proc semObjectNode(c: PContext, n: PNode, prev: PType; isInheritable: bool): PTy else: if concreteBase.kind != tyError: localError(c.config, n[1].info, "inheritance only works with non-final objects; " & - "to enable inheritance write '" & typeToString(realBase) & " of RootObj'") + "to enable inheritance write 'object of RootObj' instead of 'object'") base = nil realBase = nil if n.kind != nkObjectTy: internalError(c.config, n.info, "semObjectNode") From 4f6d3e48575104f8e3fcca9ee13447ed7e08cf24 Mon Sep 17 00:00:00 2001 From: hlaaftana <10591326+hlaaftana@users.noreply.github.com> Date: Sat, 25 Jan 2020 20:05:12 +0300 Subject: [PATCH 2/2] Re-add type information to final object error --- compiler/semtypes.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 735fc079619d3..3b9cba835eed9 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -851,7 +851,8 @@ proc semObjectNode(c: PContext, n: PNode, prev: PType; isInheritable: bool): PTy else: if concreteBase.kind != tyError: localError(c.config, n[1].info, "inheritance only works with non-final objects; " & - "to enable inheritance write 'object of RootObj' instead of 'object'") + "for " & typeToString(realBase) & " to be inheritable it must be " & + "'object of RootObj' instead of 'object'") base = nil realBase = nil if n.kind != nkObjectTy: internalError(c.config, n.info, "semObjectNode")