phasm/tests/integration/test_lang/test_literals.py
Johan B.W. de Vries 6e26c13dd3 Replaces type3 with type5
type5 is much more first principles based, so we get a lot
of weird quirks removed:

- FromLiteral no longer needs to understand AST
- Type unifications works more like Haskell
- Function types are just ordinary types, saving a lot of
  manual busywork

and more.
2025-08-05 19:57:04 +02:00

31 lines
673 B
Python

import pytest
from phasm.type5.solver import Type5SolverException
from ..helpers import Suite
@pytest.mark.integration_test
def test_expr_constant_literal_does_not_fit_module_constant():
code_py = """
CONSTANT: u8 = 1000
@exported
def testEntry() -> u8:
return CONSTANT
"""
with pytest.raises(Type5SolverException, match=r'Must fit in 1 byte\(s\)'):
Suite(code_py).run_code()
@pytest.mark.integration_test
def test_expr_constant_literal_does_not_fit_return():
code_py = """
@exported
def testEntry() -> u8:
return 1000
"""
with pytest.raises(Type5SolverException, match=r'Must fit in 1 byte\(s\)'):
Suite(code_py).run_code()