Skip to content

Commit

Permalink
[variants] More exhaustiveness checking tests for type cases
Browse files Browse the repository at this point in the history
  • Loading branch information
titzer committed Oct 12, 2024
1 parent ce48a2d commit 8f84cab
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/variants/seman/match_cover01.v3
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@seman
type T {
case A;
case B;
}

def f(t: T) {
match (t) {
x: T.A => ;
x: T.B => ;
}
}
12 changes: 12 additions & 0 deletions test/variants/seman/match_cover11.v3
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@seman
type T {
case A(y: int);
case B(z: bool);
}

def f(t: T) {
match (t) {
x: T.A => ;
x: T.B => ;
}
}
14 changes: 14 additions & 0 deletions test/variants/seman/match_cover12.v3
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@seman
type T {
case A(y: int);
case B(z: bool);
}

def f(t: T) {
var a: int;
var b: bool;
match (t) {
x: T.A => a = x.y;
x: T.B => b = x.z;
}
}
14 changes: 14 additions & 0 deletions test/variants/seman/match_cover13.v3
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@seman = TypeError @ 11:28
type T {
case A(y: int);
case B(z: bool);
}

def f(t: T) {
var a: string;
var b: bool;
match (t) {
x: T.A => a = x.y;
x: T.B => b = x.z;
}
}
14 changes: 14 additions & 0 deletions test/variants/seman/match_cover14.v3
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@seman = TypeError @ 12:28
type T {
case A(y: int);
case B(z: bool);
}

def f(t: T) {
var a: int;
var b: string;
match (t) {
x: T.A => a = x.y;
x: T.B => b = x.z;
}
}

0 comments on commit 8f84cab

Please sign in to comment.