mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-27 12:17:35 +03:00
Add failing test
This commit is contained in:
parent
d654182095
commit
7cc3330d98
@ -444,6 +444,7 @@ impl ParserContext<'_> {
|
||||
// Eat a core struct constant or core struct function call.
|
||||
expr = self.parse_associated_access_expression(expr)?;
|
||||
} else if self.check(&Token::LeftParen) {
|
||||
// TODO (@d0cd) Check that the xpression is an identifier
|
||||
// Parse a function call that's by itself.
|
||||
let (arguments, _, span) = self.parse_paren_comma_list(|p| p.parse_expression().map(Some))?;
|
||||
expr = Expression::Call(CallExpression {
|
||||
|
@ -456,7 +456,7 @@ impl<'a> CodeGenerator<'a> {
|
||||
// Lookup the function return type.
|
||||
let function_name = match input.function.borrow() {
|
||||
Expression::Identifier(identifier) => identifier.name,
|
||||
_ => unreachable!("Parsing guarantees that all `input.function` is always an identifier."),
|
||||
_ => unreachable!("Parsing guarantees that a function name is always an identifier."),
|
||||
};
|
||||
let return_type = &self.symbol_table.borrow().lookup_fn_symbol(function_name).unwrap().output_type;
|
||||
match return_type {
|
||||
|
@ -453,6 +453,8 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
||||
}
|
||||
|
||||
fn visit_call(&mut self, input: &'a CallExpression, expected: &Self::AdditionalInput) -> Self::Output {
|
||||
println!("call_expression: {}", input);
|
||||
println!("input function: {:?}", input.function);
|
||||
match &*input.function {
|
||||
// Note that the parser guarantees that `input.function` is always an identifier.
|
||||
Expression::Identifier(ident) => {
|
||||
@ -514,7 +516,7 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> {
|
||||
None
|
||||
}
|
||||
}
|
||||
_ => unreachable!("Parser guarantees that `input.function` is always an identifier."),
|
||||
_ => unreachable!("Parsing guarantees that a function name is always an identifier."),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
/*
|
||||
namespace: Parse
|
||||
expectation: Fail
|
||||
*/
|
||||
|
||||
program test.aleo {
|
||||
function x(x: u32, constant y: i32) -> u8 {
|
||||
return 100u8(0u8);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user