From 4b4c86ddf96acddbeb7ae4c2dc1a1c133c342b23 Mon Sep 17 00:00:00 2001 From: metagn Date: Mon, 16 Dec 2024 12:57:39 +0300 Subject: [PATCH] for more compatibility, skip distinct types for non generic define --- compiler/semstmts.nim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 9f6e87f9d47d4..083fb3cf161a1 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -622,7 +622,11 @@ proc checkDefineType(c: PContext; v: PSym; t: PType) = of mBoolDefine: {tyBool} of mGenericDefine: {tyString, tyCstring, tyInt..tyInt64, tyUInt..tyUInt64, tyBool, tyEnum} else: raiseAssert("unreachable") - if t.skipTypes(abstractVarRange-{tyDistinct}).kind notin typeKinds: + var skipped = abstractVarRange + if v.magic == mGenericDefine: + # no distinct types for generic define + skipped.excl tyDistinct + if t.skipTypes(skipped).kind notin typeKinds: let name = case v.magic of mStrDefine: "strdefine"