aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/ImplictCasts/ImplicitEqualsOverOptional.yql
blob: 468cab9df7d2c2265d5432bae09e849cebbcd58b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(
(let config (DataSource 'config))
(let world (Configure! world config 'PureDataSource 'yt))

(let res_sink (DataSink 'result))

# result is true for all tests below

# Int32 -> Uint64?? (false)
(let value (Int32 '"-1"))
(let commonType (OptionalType (OptionalType (DataType 'Uint64))))
(let imlicitEqualsResult (Exists (StrictCast value commonType)))
(let world (Write! world res_sink (Key) imlicitEqualsResult '('('type))))

# Just(Int32) -> Uint64?? (false)
(let value (Just (Int32 '"-1")))
(let commonType (OptionalType (OptionalType (DataType 'Uint64))))
(let imlicitEqualsResult (Exists (StrictCast value commonType)))
(let world (Write! world res_sink (Key) imlicitEqualsResult '('('type))))

# Nothing(Int32)? -> Uint64?? (true)
(let value (Just (Nothing (OptionalType (DataType 'Int32)))))
(let commonType (OptionalType (OptionalType (DataType 'Uint64))))
(let imlicitEqualsResult (Exists (StrictCast value commonType)))
(let world (Write! world res_sink (Key) imlicitEqualsResult '('('type))))

(let world (Commit! world res_sink))
(return world)

)