Skip to content

TP0213

Error: nested optional

  • optional types cannot be nested

From the golden case tests/cases/m18/tp0213_alias.tpn:

tp0213_alias.tpn
# Optionals flatten through an alias; only a literal 'T??' is nested (SPEC §3.12).
type MaybeInt = int?
let fine: MaybeInt? = None
type Bad = int??

The compiler reports:

tp0213_alias.tpn:4:12: error TP0213: optional types cannot be nested

The specification lists every code.