Add programs to trigger error cases.
This commit is contained in:
parent
1a05d5ff7a
commit
ca395b5c09
code/compiler/13/examples/errors
double_catchall.txtduplicate_type_param.txtexhausted_patterns.txtincomplete_patterns.txtinvalid_case_analysis.txtmatch_after_catchall.txtpattern_too_few_args.txtpattern_too_many_args.txtpattern_unknown_constructor.txttype_redefinition.txtunknown_lid.txtunknown_type.txtunknown_type_param.txtunknown_uid.txtwrong_type_kind.txt
6
code/compiler/13/examples/errors/double_catchall.txt
Normal file
6
code/compiler/13/examples/errors/double_catchall.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
defn main = {
|
||||||
|
case True of {
|
||||||
|
n -> { 2 }
|
||||||
|
n -> { 1 }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
data Pair a a = { MkPair a a }
|
7
code/compiler/13/examples/errors/exhausted_patterns.txt
Normal file
7
code/compiler/13/examples/errors/exhausted_patterns.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
defn main = {
|
||||||
|
case True of {
|
||||||
|
True -> { 1 }
|
||||||
|
False -> { 0 }
|
||||||
|
n -> { 2 }
|
||||||
|
}
|
||||||
|
}
|
5
code/compiler/13/examples/errors/incomplete_patterns.txt
Normal file
5
code/compiler/13/examples/errors/incomplete_patterns.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
defn main = {
|
||||||
|
case True of {
|
||||||
|
True -> { 1 }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
defn add x y = { x + y }
|
||||||
|
|
||||||
|
defn main = {
|
||||||
|
case add of {
|
||||||
|
n -> { 1 }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
defn main = {
|
||||||
|
case True of {
|
||||||
|
n -> { 2 }
|
||||||
|
True -> { 1 }
|
||||||
|
False -> { 0 }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
data List = { Nil, Cons Int List }
|
||||||
|
|
||||||
|
defn head l = {
|
||||||
|
case l of {
|
||||||
|
Nil -> { 0 }
|
||||||
|
Cons x -> { x }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
data List = { Nil, Cons Int List }
|
||||||
|
|
||||||
|
defn head l = {
|
||||||
|
case l of {
|
||||||
|
Nil -> { 0 }
|
||||||
|
Cons x y z -> { x }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
defn main = {
|
||||||
|
case True of {
|
||||||
|
NotBool -> { 1 }
|
||||||
|
True -> { 2 }
|
||||||
|
}
|
||||||
|
}
|
1
code/compiler/13/examples/errors/type_redefinition.txt
Normal file
1
code/compiler/13/examples/errors/type_redefinition.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
data Bool = { True, False }
|
3
code/compiler/13/examples/errors/unknown_lid.txt
Normal file
3
code/compiler/13/examples/errors/unknown_lid.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
defn main = {
|
||||||
|
weird 1
|
||||||
|
}
|
1
code/compiler/13/examples/errors/unknown_type.txt
Normal file
1
code/compiler/13/examples/errors/unknown_type.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
data Wrapper = { Wrap Weird }
|
1
code/compiler/13/examples/errors/unknown_type_param.txt
Normal file
1
code/compiler/13/examples/errors/unknown_type_param.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
data Wrapper = { Wrap a }
|
3
code/compiler/13/examples/errors/unknown_uid.txt
Normal file
3
code/compiler/13/examples/errors/unknown_uid.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
defn main = {
|
||||||
|
Weird 1
|
||||||
|
}
|
1
code/compiler/13/examples/errors/wrong_type_kind.txt
Normal file
1
code/compiler/13/examples/errors/wrong_type_kind.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
data Wrapper = { Wrap (Int Bool) }
|
Loading…
Reference in New Issue
Block a user