mirror of https://github.com/tbklang/tlang.git
Test cases
- Added two new checks for checking the return type of a function and matching a `ReturnStmt`'s expression's type to it
This commit is contained in:
parent
0a4cec2013
commit
dd66d2e47e
|
@ -355,6 +355,19 @@ jobs:
|
|||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Function return expression coercion (good)
|
||||
run: ./tlang typecheck source/tlang/testing/simple_function_return_type_check_good.t
|
||||
- name: Function return expression coercion (bad)
|
||||
run:
|
||||
set +e
|
||||
./tlang typecheck source/tlang/testing/simple_function_return_type_check_bad.t
|
||||
if [ $? = 255 ]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
emit:
|
||||
needs: [build, unittests]
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
module simple_function_return_type_check_bad;
|
||||
|
||||
ubyte factorial(ubyte i)
|
||||
{
|
||||
return 256;
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
module simple_function_return_type_check_good;
|
||||
|
||||
ubyte factorial(ubyte i)
|
||||
{
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue