Skip to content

Commit 0eb44ef

Browse files
committed
add fixture tests for polyvariant to variant coercion
1 parent 183ba6c commit 0eb44ef

11 files changed

+86
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/variant_coercion_open_polyvariant.res:5:19-30
4+
5+
3 │ let p = #One
6+
4 │
7+
5 │ let v: variant = (p :> variant)
8+
6 │
9+
10+
Type [> #One] is not a subtype of variant
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/variant_coercion_polyvariant_mismatch_as_attribute.res:7:19-30
4+
5+
5 │ let p: poly = #One
6+
6 │
7+
7 │ let v: variant = (p :> variant)
8+
8 │
9+
10+
Type poly = [#One | #Two] is not a subtype of variant
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/variant_coercion_polyvariant_mismatch_as_attribute2.res:7:19-30
4+
5+
5 │ let p: poly = #One
6+
6 │
7+
7 │ let v: variant = (p :> variant)
8+
8 │
9+
10+
Type poly = [#One | #Two] is not a subtype of variant
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/variant_coercion_polyvariant_unmatched_cases.res:7:19-30
4+
5+
5 │ let p: poly = #One
6+
6 │
7+
7 │ let v: variant = (p :> variant)
8+
8 │
9+
10+
Type poly = [#One | #Two] is not a subtype of variant
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/variant_coercion_polyvariant_with_payload.res:7:19-30
4+
5+
5 │ let p: poly = #One
6+
6 │
7+
7 │ let v: variant = (p :> variant)
8+
8 │
9+
10+
Type poly = [#One | #Two(string)] is not a subtype of variant
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type variant = One | Two
2+
3+
let p = #One
4+
5+
let v: variant = (p :> variant)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
type poly = [#One | #Two]
2+
3+
type variant = One | @as("two") Two
4+
5+
let p: poly = #One
6+
7+
let v: variant = (p :> variant)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
type poly = [#One | #Two]
2+
3+
type variant = One | @as(2) Two
4+
5+
let p: poly = #One
6+
7+
let v: variant = (p :> variant)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
type poly = [#One | #Two]
2+
3+
type variant = One
4+
5+
let p: poly = #One
6+
7+
let v: variant = (p :> variant)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
type poly = [#One | #Two(string)]
2+
3+
type variant = One | Two
4+
5+
let p: poly = #One
6+
7+
let v: variant = (p :> variant)

jscomp/test/VariantCoercion.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)