forked from GitHub/gf-core
added testcase for pattern matching on runtime variables
This commit is contained in:
5
testsuite/compiler/check/strMatch/strMatch.gf
Normal file
5
testsuite/compiler/check/strMatch/strMatch.gf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
abstract strMatch = {
|
||||||
|
cat S ;
|
||||||
|
fun f : S -> S ;
|
||||||
|
z : S ;
|
||||||
|
}
|
||||||
2
testsuite/compiler/check/strMatch/strMatch.gfs
Normal file
2
testsuite/compiler/check/strMatch/strMatch.gfs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
i testsuite/compiler/check/strMatch/strMatch.gf
|
||||||
|
l f z
|
||||||
8
testsuite/compiler/check/strMatch/strMatchCnc.gf
Normal file
8
testsuite/compiler/check/strMatch/strMatchCnc.gf
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
concrete strMatchCnc of strMatch = open Prelude in {
|
||||||
|
lincat S = {s : Str; b : Bool} ;
|
||||||
|
lin f x = case x.s of {
|
||||||
|
"" => {s="empty"; b=False} ;
|
||||||
|
_ => x
|
||||||
|
} ;
|
||||||
|
lin z = {s=""; b=False} ;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user