StrictCastOverList.yqls 846 B

1234567891011121314151617181920212223242526272829
  1. (
  2. (let config (DataSource 'config))
  3. (let res_sink (DataSink 'result))
  4. # List<Int32> -> List<Uint16> (good)
  5. (let targetType (ListType (DataType 'Uint16)))
  6. (let src (AsList (Int32 '1) (Int32 '2) (Int32 '3)))
  7. (let cast (StrictCast src targetType))
  8. (let world (Write! world res_sink (Key) cast '('('type))))
  9. # List<Int32> -> List<Uint16> (fail)
  10. (let targetType (ListType (DataType 'Uint16)))
  11. (let src (AsList (Int32 '1) (Int32 '-2) (Int32 '3)))
  12. (let cast (StrictCast src targetType))
  13. (let world (Write! world res_sink (Key) cast '('('type))))
  14. # List<Int32?> -> List<Uint16> (fail)
  15. (let targetType (ListType (DataType 'Uint16)))
  16. (let src (AsList (Just (Int32 '1)) (Null) (Just (Int32 '3))))
  17. (let cast (StrictCast src targetType))
  18. (let world (Write! world res_sink (Key) cast '('('type))))
  19. (let world (Commit! world res_sink))
  20. (return world)
  21. )