1414from .common import (
1515 BLESS ,
1616 INPUT_DATA ,
17+ ArrayChild ,
18+ ArrayLikeChildren ,
1719 Child ,
1820 Variable ,
1921 Result ,
@@ -92,6 +94,7 @@ def type_matches(
9294 """Checks a type and all field/generic types (recursively) against the data contained in
9395 `INPUT_DATA`."""
9496 name : str = sbtype .GetName ()
97+ print (f" [repr testing type { name } ]" )
9598 error_source = f"type '{ name } '"
9699
97100 if (r := TYPES_TESTED .get (name )) is not None :
@@ -136,7 +139,7 @@ def type_matches(
136139
137140 ty_result = ty .matches (expected , name , provider_ok )
138141
139- result = basic_type_result and type_class_result and ty_result
142+ result = type_class_result and ty_result
140143
141144 TYPES_TESTED [name ] = result
142145
@@ -212,11 +215,19 @@ def var_matches(var: Variable, expected: Variable, valobj: lldb.SBValue) -> Resu
212215 format_ok = var .format == expected .format
213216
214217 type_ok = var .type == expected .type
215- type_match_ok = type_matches (
216- valobj .GetType (),
217- valobj .GetTarget (),
218- summary_ok & synthetic_ok & format_ok & pretty_type_name_ok & pretty_print_ok ,
219- )
218+
219+ if var .has_visualizer () or expected .has_visualizer ():
220+ type_match_ok = type_matches (
221+ valobj .GetType (),
222+ valobj .GetTarget (),
223+ summary_ok
224+ & synthetic_ok
225+ & format_ok
226+ & pretty_type_name_ok
227+ & pretty_print_ok ,
228+ )
229+ else :
230+ type_match_ok = Result .Ok
220231
221232 value_ok = var .value == expected .value
222233
@@ -237,7 +248,10 @@ def var_matches(var: Variable, expected: Variable, valobj: lldb.SBValue) -> Resu
237248 else :
238249 child_types_ok = False
239250
240- child_types_ok &= type_matches (obj .GetType (), target ) == Result .Ok
251+ if var .has_visualizer () or expected .has_visualizer ():
252+ child_types_ok &= type_matches (obj .GetType (), target ) == Result .Ok
253+ else :
254+ type_match_ok = Result .Ok
241255
242256 children_ok = children_match (
243257 var .children , expected .children , valobj .GetName (), valobj
@@ -259,6 +273,8 @@ def var_matches(var: Variable, expected: Variable, valobj: lldb.SBValue) -> Resu
259273
260274 error_source = f"var '{ valobj .GetName ()} '"
261275
276+ print ("[repr var does not match]" )
277+
262278 # otherwise, we want to output exactly what doesn't match
263279 # and any additional helpful information
264280
@@ -392,6 +408,8 @@ def children_match(
392408 invalid_count = 0
393409
394410 for i in range (len (expected )):
411+ print (f" [repr testing child { i } ]" )
412+
395413 exp = expected [i ]
396414
397415 if i >= len (children ):
@@ -400,6 +418,18 @@ def children_match(
400418
401419 got = children [i ]
402420
421+ if isinstance (children , ArrayLikeChildren ):
422+ if isinstance (got , ArrayChild ):
423+ got = Child (f"[{ i } ]" , children .type , got .value , got .children )
424+ else :
425+ got = Child (f"[{ i } ]" , children .type , got , [])
426+
427+ if isinstance (expected , ArrayLikeChildren ):
428+ if isinstance (exp , ArrayChild ):
429+ exp = Child (f"[{ i } ]" , expected .type , exp .value , exp .children )
430+ else :
431+ exp = Child (f"[{ i } ]" , expected .type , exp , [])
432+
403433 if got .name is None :
404434 result = Result .Mismatch
405435 invalid_count += 1
0 commit comments