TP0229
Error: protocol used as a type
Messages
Section titled “Messages”'<P>' is a protocol, so it can only be a type parameter bound, with helpuse a bounded type parameter, e.g. 'def f[T: <P>](x: T)'(M17)'<P>' uses 'Self' in '<m>', so it can only be a type parameter bound, with M17’s help'<P>' is a protocol, with helpconstruct a class that satisfies it(a construction) ortest for a class that satisfies it(isinstance,as, class patterns,except), replacing M17’s message for these (M40)
Example
Section titled “Example”From the golden case tests/cases/m18/tp0229_alias.tpn:
# An alias names a type, and a protocol isn't one (SPEC §3.11, §3.12).type Ordered = Comparabletype Items = list[Comparable]The compiler reports:
tp0229_alias.tpn:2:16: error TP0229: 'Comparable' uses 'Self' in '__lt__', so it can only be a type parameter bound help: use a bounded type parameter, e.g. 'def f[T: Comparable](x: T)'tp0229_alias.tpn:3:19: error TP0229: 'Comparable' uses 'Self' in '__lt__', so it can only be a type parameter bound help: use a bounded type parameter, e.g. 'def f[T: Comparable](x: T)'The specification lists every code.
© 2026 Discover Edge, LLC · Taipan is released under the MIT License.