TP0217
Error: const initializer is not a constant expression
Messages
Section titled “Messages”const initializer must be a constant expressionclass attribute value must be a constant expression(M28)
Example
Section titled “Example”From the golden case tests/cases/m3/tp0217_const.tpn:
const A = 2const B = A * 2const C = len("abc")const D = 1 < 2const E = f"x"const F = (1 + 2) * -3 // 4 % 5 - 6.5 / 2const G = "a" + "b"const H = TrueThe compiler reports:
tp0217_const.tpn:2:11: error TP0217: const initializer must be a constant expressiontp0217_const.tpn:3:11: error TP0217: const initializer must be a constant expressiontp0217_const.tpn:4:11: error TP0217: const initializer must be a constant expressiontp0217_const.tpn:5:11: error TP0217: const initializer must be a constant expressionThe specification lists every code.
© 2026 Discover Edge, LLC · Taipan is released under the MIT License.