Fix assignment bug
This commit is contained in:
parent
64ce3d56e4
commit
40172e3ffb
@ -45,6 +45,8 @@ impl Assignment {
|
|||||||
|
|
||||||
impl AbstractNode for Assignment {
|
impl AbstractNode for Assignment {
|
||||||
fn define_types(&self, context: &Context) -> Result<(), ValidationError> {
|
fn define_types(&self, context: &Context) -> Result<(), ValidationError> {
|
||||||
|
self.statement.define_types(context)?;
|
||||||
|
|
||||||
let relevant_statement = self.statement.last_evaluated_statement();
|
let relevant_statement = self.statement.last_evaluated_statement();
|
||||||
let statement_type = if let Some(r#type) = relevant_statement.expected_type(context)? {
|
let statement_type = if let Some(r#type) = relevant_statement.expected_type(context)? {
|
||||||
r#type
|
r#type
|
||||||
@ -113,7 +115,7 @@ impl AbstractNode for Assignment {
|
|||||||
r#type
|
r#type
|
||||||
} else {
|
} else {
|
||||||
return Err(ValidationError::CannotAssignToNone(
|
return Err(ValidationError::CannotAssignToNone(
|
||||||
self.statement.position(),
|
relevant_statement.position(),
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -116,9 +116,19 @@ impl AbstractNode for FunctionCall {
|
|||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
function.populate_context_template()?;
|
let function_context = Context::new(None);
|
||||||
|
|
||||||
let function_context = function.context_template().create_child();
|
if let Some(type_parameters) = function.type_parameters() {
|
||||||
|
for identifier in type_parameters {
|
||||||
|
function_context.set_type(
|
||||||
|
identifier.clone(),
|
||||||
|
Type::Generic {
|
||||||
|
identifier: identifier.clone(),
|
||||||
|
concrete_type: None,
|
||||||
|
},
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let (Some(parameters), Some(arguments)) =
|
if let (Some(parameters), Some(arguments)) =
|
||||||
(function.value_parameters(), self.value_arguments)
|
(function.value_parameters(), self.value_arguments)
|
||||||
|
Loading…
Reference in New Issue
Block a user