shift_struct_member.sol 586 B

1234567891011121314151617181920212223
  1. // Test case for https://github.com/hyperledger/solang/issues/732
  2. library FixedPoint {
  3. struct uq144x112 {
  4. uint _x;
  5. }
  6. struct uq112x112 {
  7. uint224 _x;
  8. }
  9. // this errors with `type not allowed Ref(Uint(224))`
  10. function decode(uq112x112 memory self) internal pure returns (uint112) {
  11. return uint112(self._x >> 112);
  12. }
  13. // this error with `type not allowed Ref(Uint(256))`
  14. function decode144(uq144x112 memory self) internal pure returns (uint144) {
  15. return uint144(self._x >> 112);
  16. }
  17. }
  18. // ---- Expect: diagnostics ----