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