mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
fixes #21281
(cherry picked from commit 74499e4561)
This commit is contained in:
@@ -1164,7 +1164,15 @@ proc addImplicitGeneric(c: PContext; typeClass: PType, typId: PIdent;
|
||||
# is this a bindOnce type class already present in the param list?
|
||||
for i in 0..<genericParams.len:
|
||||
if genericParams[i].sym.name.id == finalTypId.id:
|
||||
return genericParams[i].typ
|
||||
if typeClass.kind == tyStatic and genericParams[i].typ.kind != tyStatic:
|
||||
# The base type (e.g. from `auto`) was already added as a generic param,
|
||||
# but `static[auto]` requires upgrading it to a `tyStatic` wrapper so
|
||||
# it is instantiated as a compile-time value (`skConst`).
|
||||
genericParams[i].sym.linkTo(typeClass)
|
||||
typeClass.incl tfImplicitTypeParam
|
||||
return typeClass
|
||||
else:
|
||||
return genericParams[i].typ
|
||||
|
||||
let owner = if typeClass.sym != nil: typeClass.sym
|
||||
else: getCurrOwner(c)
|
||||
|
||||
Reference in New Issue
Block a user