From f7d682eae5af7ac23d53bc7091338cde9fe0f1cb Mon Sep 17 00:00:00 2001 From: "Andrey R (cooldome)" Date: Thu, 5 Nov 2020 19:25:40 +0000 Subject: [PATCH] close #7546 --- compiler/semtypes.nim | 2 +- tests/statictypes/tstatictypes.nim | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 21667895a253f..467645aeeffea 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -159,7 +159,7 @@ proc semSet(c: PContext, n: PNode, prev: PType): PType = var base = semTypeNode(c, n[1], nil) addSonSkipIntLit(result, base, c.idgen) if base.kind in {tyGenericInst, tyAlias, tySink}: base = lastSon(base) - if base.kind != tyGenericParam: + if base.kind notin {tyGenericParam, tyGenericInvocation}: if not isOrdinalType(base, allowEnumWithHoles = true): localError(c.config, n.info, errOrdinalTypeExpected) elif lengthOrd(c.config, base) > MaxSetElements: diff --git a/tests/statictypes/tstatictypes.nim b/tests/statictypes/tstatictypes.nim index 619d0001c09a7..0e35a633c3c47 100644 --- a/tests/statictypes/tstatictypes.nim +++ b/tests/statictypes/tstatictypes.nim @@ -295,3 +295,11 @@ barM() fooParam(foo) barParam(bar) + +#----------------------------------------------------------------------------------------- +# issue #7546 +type + rangeB[N: static[int16]] = range[0'i16 .. N] + setB[N: static[int16]] = set[rangeB[N]] + +var s : setB[14'i16] \ No newline at end of file