aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/julia.rst2
-rw-r--r--test/libjulia/Parser.cpp10
2 files changed, 7 insertions, 5 deletions
diff --git a/docs/julia.rst b/docs/julia.rst
index 014cd00b..309e6b36 100644
--- a/docs/julia.rst
+++ b/docs/julia.rst
@@ -252,7 +252,7 @@ We will use a destructuring notation for the AST nodes.
G, L, continue
E(G, L, <if condition body>: If) =
let G0, L0, v = E(G, L, condition)
- if v is true or non-zero:
+ if v is true:
E(G0, L0, body)
else:
G0, L0, regular
diff --git a/test/libjulia/Parser.cpp b/test/libjulia/Parser.cpp
index 473a1d2c..9aa325a4 100644
--- a/test/libjulia/Parser.cpp
+++ b/test/libjulia/Parser.cpp
@@ -271,15 +271,17 @@ BOOST_AUTO_TEST_CASE(multiple_assignment)
BOOST_AUTO_TEST_CASE(if_statement)
{
- BOOST_CHECK(successParse("{ if 42:u256 {} }"));
- BOOST_CHECK(successParse("{ if 42:u256 { let x:u256 := 3:u256 } }"));
- BOOST_CHECK(successParse("{ function f() -> x:u256 {} if f() { let b:u256 := f() } }"));
+ BOOST_CHECK(successParse("{ if true:bool {} }"));
+ BOOST_CHECK(successParse("{ if false:bool { let x:u256 := 3:u256 } }"));
+ BOOST_CHECK(successParse("{ function f() -> x:bool {} if f() { let b:bool := f() } }"));
}
BOOST_AUTO_TEST_CASE(if_statement_invalid)
{
CHECK_ERROR("{ if let x:u256 {} }", ParserError, "Literal or identifier expected.");
- CHECK_ERROR("{ if 32:u256 let x:u256 := 3:u256 }", ParserError, "Expected token LBrace");
+ CHECK_ERROR("{ if true:bool let x:u256 := 3:u256 }", ParserError, "Expected token LBrace");
+ // TODO change this to an error once we check types.
+ BOOST_CHECK(successParse("{ if 42:u256 { } }"));
}
BOOST_AUTO_TEST_SUITE_END()