@@ -159,21 +159,23 @@ fn parse_control_operator(types: &mut IntermediateTypes, parent: &Type2AndParent
159
159
Type2 :: IntValue { value, .. } => Some ( value as i128 ) ,
160
160
_ => unimplemented ! ( "unsupported type in range control operator: {:?}" , operator) ,
161
161
} ;
162
- let max = match & inner_type. operator {
162
+ match & inner_type. operator {
163
+ // if there was only one value instead of a range, we take that value to be the max
164
+ // ex: uint .size (1)
165
+ None => ControlOperator :: Range ( ( None , min) ) ,
163
166
Some ( op) => match op. operator {
164
167
RangeCtlOp :: RangeOp { is_inclusive, ..} => {
165
168
let value = match op. type2 {
166
169
Type2 :: UintValue { value, .. } => value as i128 ,
167
170
Type2 :: IntValue { value, ..} => value as i128 ,
168
171
_ => unimplemented ! ( "unsupported type in range control operator: {:?}" , operator) ,
169
172
} ;
170
- Some ( if is_inclusive { value } else { value + 1 } )
173
+ let max = Some ( if is_inclusive { value } else { value + 1 } ) ;
174
+ ControlOperator :: Range ( ( min, max) )
171
175
} ,
172
176
RangeCtlOp :: CtlOp { .. } => panic ! ( "" ) ,
173
177
} ,
174
- None => min,
175
- } ;
176
- ControlOperator :: Range ( ( min, max) )
178
+ }
177
179
} ,
178
180
_ => unimplemented ! ( "unsupported type in range control operator: {:?}" , operator) ,
179
181
} ;
@@ -672,6 +674,9 @@ fn rust_type_from_type2(types: &mut IntermediateTypes, type2: &Type2AndParent) -
672
674
Type2 :: TaggedData { tag, t, .. } => {
673
675
RustType :: Tagged ( tag. expect ( "tagged data without tag not supported" ) , Box :: new ( rust_type ( types, t) ) )
674
676
} ,
677
+ Type2 :: ParenthesizedType { pt, .. } => {
678
+ rust_type ( types, pt)
679
+ } ,
675
680
_ => {
676
681
panic ! ( "Ignoring Type2: {:?}" , type2. type2) ;
677
682
} ,
0 commit comments