Use type definitions for type checks
This commit is contained in:
parent
4a42f51580
commit
f04adfc661
@ -38,10 +38,13 @@ impl AbstractTree for Assignment {
|
||||
let statement = Statement::from_syntax(statement_node, source, context)?;
|
||||
|
||||
if let AssignmentOperator::Equal = operator {
|
||||
context.set_type(
|
||||
identifier.inner().clone(),
|
||||
statement.expected_type(context)?,
|
||||
)?;
|
||||
let r#type = if let Some(definition) = &type_definition {
|
||||
definition.inner().clone()
|
||||
} else {
|
||||
statement.expected_type(context)?
|
||||
};
|
||||
|
||||
context.set_type(identifier.inner().clone(), r#type)?;
|
||||
}
|
||||
|
||||
Ok(Assignment {
|
||||
|
@ -12,8 +12,6 @@ fn simple_type_check() {
|
||||
|
||||
#[test]
|
||||
fn argument_count_check() {
|
||||
env_logger::builder().is_test(true).try_init().unwrap();
|
||||
|
||||
let source = "
|
||||
foo = (x <int>) <int> {
|
||||
x
|
||||
|
Loading…
Reference in New Issue
Block a user