diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 2aa646dd60d91..30f4aa6ad0dbe 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -1361,7 +1361,8 @@ const tyDotOpTransparent = {tyVar, tyLent, tyPtr, tyRef, tyOwned, tyAlias, tySink} proc readTypeParameter(c: PContext, typ: PType, - paramName: PIdent, info: TLineInfo): PNode = + paramName: PIdent, info: TLineInfo, skip = true): PNode = + ## - **skip**: Skips generic aliases and tries to get the parameter from the aliased type. # Note: This function will return emptyNode when attempting to read # a static type parameter that is not yet resolved (e.g. this may # happen in proc signatures such as `proc(x: T): array[T.sizeParam, U]` @@ -1387,8 +1388,12 @@ proc readTypeParameter(c: PContext, typ: PType, discard if typ.kind != tyUserTypeClass: - let ty = if typ.kind == tyCompositeTypeClass: typ.firstGenericParam.skipGenericAlias - else: typ.skipGenericAlias + let ty = block: + let ty = if typ.kind == tyCompositeTypeClass: typ.firstGenericParam + else: typ + if skip: typ.skipGenericAlias() + else: typ + let tbody = ty[0] for s in 0..