forked from GitHub/gf-core
Implicit arguments in GF. Works only in PGF for now.
This commit is contained in:
19
testsuite/runtime/typecheck/Graph.gf
Normal file
19
testsuite/runtime/typecheck/Graph.gf
Normal file
@@ -0,0 +1,19 @@
|
||||
abstract Graph = {
|
||||
|
||||
cat
|
||||
Node ;
|
||||
Link (n,m : Node) ;
|
||||
Path (n,m : Node) ;
|
||||
Label ({n} : Node) ; -- just to debug implicit arguments of categories
|
||||
|
||||
fun
|
||||
n1,n2,n3,n4,n5 : Node ;
|
||||
|
||||
l12 : Link n1 n2 ;
|
||||
l23 : Link n2 n3 ;
|
||||
l34 : Link n3 n4 ;
|
||||
l35 : Link n3 n5 ;
|
||||
|
||||
link : ({n,m} : Node) -> Link n m -> Path n m ;
|
||||
join : ({n,p,m} : Node) -> Link n p -> Path p m -> Path n m ;
|
||||
}
|
||||
9
testsuite/runtime/typecheck/implicit-arguments.gfs
Normal file
9
testsuite/runtime/typecheck/implicit-arguments.gfs
Normal file
@@ -0,0 +1,9 @@
|
||||
i testsuite/runtime/typecheck/Graph.gf
|
||||
ai join l12 (link l23)
|
||||
ai join {n1} {n2} {n3} l12 (link {n2} {n3} l23)
|
||||
ai <? : Label>
|
||||
ai <? : Label {n1}>
|
||||
ai <? : Link {n1} {n2}>
|
||||
ai <\x -> x : ({m},n : Node) -> Node>
|
||||
ai <n1 : ({m} : Node) -> Node>
|
||||
ai <? : ({m} : Node) -> Node>
|
||||
22
testsuite/runtime/typecheck/implicit-arguments.gfs.gold
Normal file
22
testsuite/runtime/typecheck/implicit-arguments.gfs.gold
Normal file
@@ -0,0 +1,22 @@
|
||||
Expression: join {n1} {n2} {n3} l12 (link {n2} {n3} l23)
|
||||
|
||||
Type: Path n1 n3
|
||||
|
||||
|
||||
|
||||
Expression: join {n1} {n2} {n3} l12 (link {n2} {n3} l23)
|
||||
|
||||
Type: Path n1 n3
|
||||
|
||||
|
||||
|
||||
Expression: <?2 : Label {?1}>
|
||||
|
||||
Type: Label {?1}
|
||||
|
||||
|
||||
|
||||
Expression: <?2 : Label {n1}>
|
||||
|
||||
Type: Label {n1}
|
||||
|
||||
Reference in New Issue
Block a user