@@ -1493,21 +1493,28 @@ dummy_func(void) {
14931493
14941494 op (_BINARY_SLICE , (container , start , stop -- res )) {
14951495 // Slicing a string/list/tuple always returns the same type.
1496- PyTypeObject * type = sym_get_probable_type (container );
1496+ PyTypeObject * known_type = sym_get_type (container );
1497+ PyTypeObject * type = known_type ? known_type : sym_get_probable_type (container );
14971498 if (type == & PyList_Type ) {
1498- ADD_OP (_GUARD_3OS_TYPE , 0 , (uintptr_t )type );
1499+ if (!known_type ) {
1500+ ADD_OP (_GUARD_3OS_TYPE , 0 , (uintptr_t )type );
1501+ }
14991502 ADD_OP (_UNPACK_INDICES , 0 , 0 );
15001503 ADD_OP (_BINARY_SLICE_LIST , 0 , 0 );
15011504 res = sym_new_type (ctx , type );
15021505 }
15031506 else if (type == & PyTuple_Type ) {
1504- ADD_OP (_GUARD_3OS_TYPE , 0 , (uintptr_t )type );
1507+ if (!known_type ) {
1508+ ADD_OP (_GUARD_3OS_TYPE , 0 , (uintptr_t )type );
1509+ }
15051510 ADD_OP (_UNPACK_INDICES , 0 , 0 );
15061511 ADD_OP (_BINARY_SLICE_TUPLE , 0 , 0 );
15071512 res = sym_new_type (ctx , type );
15081513 }
15091514 else if (type == & PyUnicode_Type ) {
1510- ADD_OP (_GUARD_3OS_TYPE , 0 , (uintptr_t )type );
1515+ if (!known_type ) {
1516+ ADD_OP (_GUARD_3OS_TYPE , 0 , (uintptr_t )type );
1517+ }
15111518 ADD_OP (_UNPACK_INDICES , 0 , 0 );
15121519 ADD_OP (_BINARY_SLICE_UNICODE , 0 , 0 );
15131520 res = sym_new_type (ctx , type );
@@ -1519,8 +1526,8 @@ dummy_func(void) {
15191526
15201527 op (_UNPACK_INDICES , (container , start , stop -- container , sta , sto )) {
15211528 (void )container ;
1522- sta = sym_new_compact_int (ctx );
1523- sto = sym_new_compact_int (ctx );
1529+ sta = sym_new_type (ctx , & PyLong_Type );
1530+ sto = sym_new_type (ctx , & PyLong_Type );
15241531 }
15251532
15261533 op (_GUARD_GLOBALS_VERSION , (version /1 -- )) {
0 commit comments