@@ -1550,6 +1550,17 @@ fn resolveStringLiteral(analyser: *Analyser, node_param: NodeWithHandle) !?[]con
15501550 return field_name [1 .. field_name .len - 1 ];
15511551}
15521552
1553+ fn resolveErrorSetIPIndex (analyser : * Analyser , node_handle : NodeWithHandle ) error {OutOfMemory }! ? InternPool.Index {
1554+ const ty = try analyser .resolveTypeOfNodeInternal (node_handle ) orelse return null ;
1555+ if (! ty .is_type_val ) return null ;
1556+ const ip_index = switch (ty .data ) {
1557+ .ip_index = > | payload | payload .index orelse return null ,
1558+ else = > return null ,
1559+ };
1560+ if (analyser .ip .zigTypeTag (ip_index ) != .error_set ) return null ;
1561+ return ip_index ;
1562+ }
1563+
15531564const FindBreaks = struct {
15541565 const Error = error {OutOfMemory };
15551566
@@ -1921,20 +1932,8 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, node_handle: NodeWithHandle) e
19211932
19221933 .merge_error_sets = > {
19231934 const lhs , const rhs = tree .nodeData (node ).node_and_node ;
1924- const lhs_ty = try analyser .resolveTypeOfNodeInternal (.of (lhs , handle )) orelse return null ;
1925- const rhs_ty = try analyser .resolveTypeOfNodeInternal (.of (rhs , handle )) orelse return null ;
1926- if (! lhs_ty .is_type_val ) return null ;
1927- if (! rhs_ty .is_type_val ) return null ;
1928- const lhs_index = switch (lhs_ty .data ) {
1929- .ip_index = > | payload | payload .index orelse return null ,
1930- else = > return null ,
1931- };
1932- const rhs_index = switch (rhs_ty .data ) {
1933- .ip_index = > | payload | payload .index orelse return null ,
1934- else = > return null ,
1935- };
1936- if (analyser .ip .zigTypeTag (lhs_index ) != .error_set ) return null ;
1937- if (analyser .ip .zigTypeTag (rhs_index ) != .error_set ) return null ;
1935+ const lhs_index = try analyser .resolveErrorSetIPIndex (.of (lhs , handle )) orelse return null ;
1936+ const rhs_index = try analyser .resolveErrorSetIPIndex (.of (rhs , handle )) orelse return null ;
19381937 const ip_index = try analyser .ip .errorSetMerge (analyser .gpa , lhs_index , rhs_index );
19391938 return Type .fromIP (analyser , .type_type , ip_index );
19401939 },
@@ -2650,17 +2649,17 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, node_handle: NodeWithHandle) e
26502649 = > {
26512650 const lhs , const rhs = tree .nodeData (node ).node_and_node ;
26522651 const lhs_ty = try analyser .resolveTypeOfNodeInternal (.of (lhs , handle )) orelse return null ;
2653- const rhs_ty = try analyser .resolveTypeOfNodeInternal (.of (rhs , handle )) orelse return null ;
26542652 if (lhs_ty .is_type_val ) return null ;
2653+ const rhs_ty = try analyser .resolveTypeOfNodeInternal (.of (rhs , handle )) orelse return null ;
26552654 if (rhs_ty .is_type_val ) return null ;
26562655 return Type .resolvePeerTypes (analyser , lhs_ty , rhs_ty );
26572656 },
26582657
26592658 .add = > {
26602659 const lhs , const rhs = tree .nodeData (node ).node_and_node ;
26612660 const lhs_ty = try analyser .resolveTypeOfNodeInternal (.of (lhs , handle )) orelse return null ;
2662- const rhs_ty = try analyser .resolveTypeOfNodeInternal (.of (rhs , handle )) orelse return null ;
26632661 if (lhs_ty .is_type_val ) return null ;
2662+ const rhs_ty = try analyser .resolveTypeOfNodeInternal (.of (rhs , handle )) orelse return null ;
26642663 if (rhs_ty .is_type_val ) return null ;
26652664 return switch (lhs_ty .data ) {
26662665 .pointer = > | lhs_info | switch (lhs_info .size ) {
@@ -2674,8 +2673,8 @@ fn resolveTypeOfNodeUncached(analyser: *Analyser, node_handle: NodeWithHandle) e
26742673 .sub = > {
26752674 const lhs , const rhs = tree .nodeData (node ).node_and_node ;
26762675 const lhs_ty = try analyser .resolveTypeOfNodeInternal (.of (lhs , handle )) orelse return null ;
2677- const rhs_ty = try analyser .resolveTypeOfNodeInternal (.of (rhs , handle )) orelse return null ;
26782676 if (lhs_ty .is_type_val ) return null ;
2677+ const rhs_ty = try analyser .resolveTypeOfNodeInternal (.of (rhs , handle )) orelse return null ;
26792678 if (rhs_ty .is_type_val ) return null ;
26802679 return switch (lhs_ty .data ) {
26812680 .pointer = > | lhs_info | switch (rhs_ty .data ) {
0 commit comments