Add tests for default implict record type arguments

This commit is contained in:
Ohad Kammar 2020-04-17 12:22:36 +01:00
parent 5af82beb4e
commit 767d9dc5f3
3 changed files with 37 additions and 1 deletions

View File

@ -14,3 +14,20 @@ b = Check
{- Will not type-check
c : Positive 0
-}
data KindOfString = ASCII | UTF
UTForASCII : KindOfString -> Type
UTForASCII UTF = String
UTForASCII ASCII = List Char --- Just to demonstrate
record FlexiString { default UTF k : KindOfString} where
constructor MkFlexiString
val : UTForASCII k
c : FlexiString
c = MkFlexiString "hello"
d : FlexiString {k = ASCII}
d = MkFlexiString ['h', 'i']

View File

@ -14,3 +14,22 @@ a = Check
b : Positive (S (S Z))
b = Check
data KindOfString : Type where
ASCII : KindOfString
UTF : KindOfString
UTForASCII : KindOfString -> Type
UTForASCII UTF = String
UTForASCII ASCII = Nat -- Just as demonstration
record FlexiString { default UTF k : KindOfString} where
constructor MkFlexiString
val : UTForASCII k
c : FlexiString
c = MkFlexiString "hello"
d : FlexiString {k = ASCII}
d = MkFlexiString Z

View File

@ -1,4 +1,4 @@
$1 --yaffle Record.yaff -c < input
$1 --yaffle Record.yaff < input
$1 --yaffle build/ttc/Record.ttc < input
rm -rf build