forked from GitHub/gf-core
hopefully complete and correct typechecker in PGF
This commit is contained in:
@@ -14,7 +14,7 @@ def g0 = g2 ;
|
||||
fun g3 : Int -> (Int -> Int) ;
|
||||
def g3 3 = g ;
|
||||
|
||||
fun const : Int -> Int -> Int ;
|
||||
fun const : Float -> String -> Float ;
|
||||
def const x _ = x ;
|
||||
|
||||
cat Nat ;
|
||||
|
||||
@@ -1,34 +1,30 @@
|
||||
i testsuite/runtime/eval/Test.gf
|
||||
|
||||
pt -compute \x -> x 1
|
||||
pt -compute ? 1
|
||||
pt -compute (\x -> x 1) ?
|
||||
pt -compute unknown_var
|
||||
pt -compute unknown_var 1
|
||||
pt -compute 1 2
|
||||
pt -compute \x -> x 1 : (Int->Int)->Int
|
||||
pt -compute (? : Int -> Int) 1
|
||||
pt -compute (\x -> x 1 : (Int->Int)->Int) ?
|
||||
pt -compute f 1 2
|
||||
pt -compute \x -> x
|
||||
pt -compute ?666
|
||||
pt -compute \x -> x : Nat -> Nat
|
||||
pt -compute ? : String
|
||||
pt -compute f
|
||||
pt -compute (\x -> x 2) (f 1)
|
||||
pt -compute (\x -> x 2) 1
|
||||
pt -compute (\x -> x 2 : (Int->Int)->Int) (f 1)
|
||||
pt -compute g 1
|
||||
pt -compute g 0
|
||||
pt -compute \x -> g x
|
||||
pt -compute \x -> g x : Int -> Int
|
||||
pt -compute g ?
|
||||
pt -compute (\x -> x 5) (g2 1)
|
||||
pt -compute (\x -> x 3) (\x -> x)
|
||||
pt -compute (\x -> x 5 : (Int->Int)->Int) (g2 1)
|
||||
pt -compute (\x -> x 3 : (Int->Int)->Int) (\x -> x)
|
||||
pt -compute g0
|
||||
pt -compute (\x -> x 3.2) (\x -> f x)
|
||||
pt -compute g0 2.3
|
||||
pt -compute g0 ((\x -> f x) 0) 1
|
||||
pt -compute (\x -> x 32 : (Int -> Int -> Int) -> Int -> Int) (\x -> f x : Int -> Int -> Int)
|
||||
pt -compute g0 23
|
||||
pt -compute const 3.14 "pi"
|
||||
pt -compute dec (succ (succ zero))
|
||||
pt -compute dec (succ ?)
|
||||
pt -compute \x -> dec x
|
||||
pt -compute \x -> dec x : Nat -> Nat
|
||||
pt -compute dec ?
|
||||
pt -compute (\f -> f 0) (g3 ?)
|
||||
pt -compute (\f -> f 0 : (Int -> Int) -> Int) (g3 ?)
|
||||
pt -compute g (g2 ? 0)
|
||||
pt -compute plus (succ zero) (succ zero)
|
||||
pt -compute dec2 0 (succ zero)
|
||||
pt -compute dec2 0 err
|
||||
pt -compute plus err (succ zero)
|
||||
@@ -1,30 +1,26 @@
|
||||
\v0 -> v0 1␍
|
||||
\x -> x 1␍
|
||||
␍
|
||||
? 1␍
|
||||
?1 1␍
|
||||
␍
|
||||
? 1␍
|
||||
?3 1␍
|
||||
␍
|
||||
unknown variable unknown_var␍
|
||||
unknown variable unknown_var␍
|
||||
literal of function type␍
|
||||
f 1 2␍
|
||||
␍
|
||||
\v0 -> v0␍
|
||||
\x -> x␍
|
||||
␍
|
||||
?666␍
|
||||
?1␍
|
||||
␍
|
||||
f␍
|
||||
␍
|
||||
f 1 2␍
|
||||
␍
|
||||
literal of function type␍
|
||||
2␍
|
||||
␍
|
||||
g 0␍
|
||||
␍
|
||||
\v0 -> g v0␍
|
||||
\x -> g x␍
|
||||
␍
|
||||
g ?␍
|
||||
g ?1␍
|
||||
␍
|
||||
5␍
|
||||
␍
|
||||
@@ -32,29 +28,29 @@ g ?
|
||||
␍
|
||||
g2␍
|
||||
␍
|
||||
f 3.2␍
|
||||
f 32␍
|
||||
␍
|
||||
g2 2.3␍
|
||||
␍
|
||||
g2 (f 0) 1␍
|
||||
g2 23␍
|
||||
␍
|
||||
3.14␍
|
||||
␍
|
||||
succ zero␍
|
||||
␍
|
||||
?␍
|
||||
?1␍
|
||||
␍
|
||||
\v0 -> dec v0␍
|
||||
\x -> dec x␍
|
||||
␍
|
||||
dec ?␍
|
||||
dec ?1␍
|
||||
␍
|
||||
g3 ? 0␍
|
||||
g3 ?3 0␍
|
||||
␍
|
||||
g (g2 ? 0)␍
|
||||
g (g2 ?1 0)␍
|
||||
␍
|
||||
succ (succ zero)␍
|
||||
␍
|
||||
zero␍
|
||||
␍
|
||||
dec2 0 err␍
|
||||
␍
|
||||
succ err␍
|
||||
␍
|
||||
|
||||
Reference in New Issue
Block a user