Fixed a wrong test that the new typer caught

Also, some fixes of things that were broken on structs
due to the tuple changes
This commit is contained in:
Johan B.W. de Vries 2023-01-01 15:02:23 +01:00
parent 7f0acf00fe
commit f281b78c78
3 changed files with 5 additions and 5 deletions

View File

@ -108,7 +108,7 @@ class SameTypeConstraint(ConstraintBase):
placeholders = [] placeholders = []
do_applied_placeholder_check: bool = False do_applied_placeholder_check: bool = False
for typ in self.type_list: for typ in self.type_list:
if isinstance(typ, types.PrimitiveType3): if isinstance(typ, (types.PrimitiveType3, types.StructType3, )):
known_types.append(typ) known_types.append(typ)
continue continue

View File

@ -8,7 +8,7 @@ from .. import ourlang
from .constraints import ConstraintBase, Error, RequireTypeSubstitutes, SameTypeConstraint, SubstitutionMap from .constraints import ConstraintBase, Error, RequireTypeSubstitutes, SameTypeConstraint, SubstitutionMap
from .constraintsgenerator import phasm_type3_generate_constraints from .constraintsgenerator import phasm_type3_generate_constraints
from .types import AppliedType3, PlaceholderForType, PrimitiveType3, Type3, Type3OrPlaceholder from .types import AppliedType3, PlaceholderForType, PrimitiveType3, StructType3, Type3, Type3OrPlaceholder
MAX_RESTACK_COUNT = 100 MAX_RESTACK_COUNT = 100
@ -125,7 +125,7 @@ def print_constraint(placeholder_id_map: Dict[int, str], constraint: ConstraintB
print('- ' + txt.format(**act_fmt)) print('- ' + txt.format(**act_fmt))
def get_printable_type_name(inp: Type3OrPlaceholder, placeholder_id_map: Dict[int, str]) -> str: def get_printable_type_name(inp: Type3OrPlaceholder, placeholder_id_map: Dict[int, str]) -> str:
if isinstance(inp, PrimitiveType3): if isinstance(inp, (PrimitiveType3, StructType3, )):
return inp.name return inp.name
if isinstance(inp, PlaceholderForType): if isinstance(inp, PlaceholderForType):

View File

@ -2,7 +2,7 @@ import pytest
from phasm.type3.entry import Type3Exception from phasm.type3.entry import Type3Exception
from ..constants import ALL_FLOAT_TYPES, COMPLETE_NUMERIC_TYPES, TYPE_MAP from ..constants import ALL_FLOAT_TYPES, COMPLETE_INT_TYPES, TYPE_MAP
from ..helpers import Suite from ..helpers import Suite
@pytest.mark.integration_test @pytest.mark.integration_test
@ -82,7 +82,7 @@ def helper(x: u8) -> u8:
Suite(code_py).run_code() Suite(code_py).run_code()
@pytest.mark.integration_test @pytest.mark.integration_test
@pytest.mark.parametrize('type_', COMPLETE_NUMERIC_TYPES) @pytest.mark.parametrize('type_', COMPLETE_INT_TYPES)
def test_tuple_simple_constructor_int(type_): def test_tuple_simple_constructor_int(type_):
code_py = f""" code_py = f"""
@exported @exported