diff --git a/compiler/semfold.nim b/compiler/semfold.nim index 3425aaaf6a..b892ce178b 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -412,7 +412,6 @@ proc foldConv(n, a: PNode; idgen: IdGenerator; g: ModuleGraph; check = false): P if dstTyp.kind in {tyUInt..tyUInt64}: result = newIntNodeT(maskBytes(val, getSize(g.config, dstTyp)), n, idgen, g) result.transitionIntKind(nkUIntLit) - result.typ = dstTyp else: if check: rangeCheck(n, val, g) result = newIntNodeT(val, n, idgen, g) diff --git a/tests/int/t1.nim b/tests/int/t1.nim index a88a3f34ca..28ffa76735 100644 --- a/tests/int/t1.nim +++ b/tests/int/t1.nim @@ -42,3 +42,10 @@ block: # bug #23954 doAssert testRT_u8 == 7 const testCT_u8 : uint8 = 0x107.uint8 doAssert testCT_u8 == 7 + +block: # issue #24104 + type P = distinct uint # uint, uint8, uint16, uint32, uint64 + let v = 0.P + case v + of 0.P: discard + else: discard