@@ -185,21 +185,23 @@ fn parse_control_operator(types: &mut IntermediateTypes, parent_visitor: &Parent
185
185
Type2 :: IntValue { value, .. } => Some ( value as i128 ) ,
186
186
_ => unimplemented ! ( "unsupported type in range control operator: {:?}" , operator) ,
187
187
} ;
188
- let max = match & inner_type. operator {
188
+ match & inner_type. operator {
189
+ // if there was only one value instead of a range, we take that value to be the max
190
+ // ex: uint .size (1)
191
+ None => ControlOperator :: Range ( ( None , min) ) ,
189
192
Some ( op) => match op. operator {
190
193
RangeCtlOp :: RangeOp { is_inclusive, ..} => {
191
194
let value = match op. type2 {
192
195
Type2 :: UintValue { value, .. } => value as i128 ,
193
196
Type2 :: IntValue { value, ..} => value as i128 ,
194
197
_ => unimplemented ! ( "unsupported type in range control operator: {:?}" , operator) ,
195
198
} ;
196
- Some ( if is_inclusive { value } else { value + 1 } )
199
+ let max = Some ( if is_inclusive { value } else { value + 1 } ) ;
200
+ ControlOperator :: Range ( ( min, max) )
197
201
} ,
198
202
RangeCtlOp :: CtlOp { .. } => panic ! ( "" ) ,
199
203
} ,
200
- None => min,
201
- } ;
202
- ControlOperator :: Range ( ( min, max) )
204
+ }
203
205
} ,
204
206
_ => unimplemented ! ( "unsupported type in range control operator: {:?}" , operator) ,
205
207
} ;
@@ -698,6 +700,9 @@ fn rust_type_from_type2(types: &mut IntermediateTypes, parent_visitor: &ParentVi
698
700
Type2 :: TaggedData { tag, t, .. } => {
699
701
RustType :: Tagged ( tag. expect ( "tagged data without tag not supported" ) , Box :: new ( rust_type ( types, parent_visitor, t) ) )
700
702
} ,
703
+ Type2 :: ParenthesizedType { pt, .. } => {
704
+ rust_type ( types, parent_visitor, pt)
705
+ } ,
701
706
_ => {
702
707
panic ! ( "Ignoring Type2: {:?}" , type2) ;
703
708
} ,
0 commit comments