You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeFoo=objectofRootObjBar=objectofFooBaz[T:Foo] =objectofRootObj
val:T
let x =Baz[Bar]()#Error object constructor needs an object typetypeQux=object
val:Baz[Bar]
let y =Qux() #Error: invalid type: 'Baz[Baz.T]' in this context: 'Qux' for let
concepts work:
typeFoo=objectofRootObjIsFoo=concepttype t
t isFooBar=objectofFooBaz[T:IsFoo] =objectofRootObj
val:T
Qux=object
val:Baz[Bar]
let x =Baz[Bar]()#finelet y =Qux() #fine
another workaround:
funcinit[T:Foo](b: typeBaz; c: typedesc[T]):Baz[T] =discardlet x =Baz.init(Bar)
Works if passing just Foo instead of Bar
The text was updated successfully, but these errors were encountered:
metagn
changed the title
Object types as generic constraints do not work
Object types as generic constraints do not work when passing subtypes
Nov 17, 2024
metagn
changed the title
Object types as generic constraints do not work when passing subtypes
Object types as generic constraints are treated as uninstantiated when passing subtypes
Nov 17, 2024
Originally mentioned in this comment: #7713 (comment)
Encountered in:
concepts work:
another workaround:
Works if passing just
Foo
instead ofBar
The text was updated successfully, but these errors were encountered: