1
0

Fix validation bug

This commit is contained in:
Jeff 2024-02-18 04:57:05 -05:00
parent a52eadc5ad
commit 5450f00174

View File

@ -63,6 +63,8 @@ impl AbstractTree for For {
} }
fn validate(&self, _source: &str, context: &Context) -> Result<(), ValidationError> { fn validate(&self, _source: &str, context: &Context) -> Result<(), ValidationError> {
self.collection.validate(_source, context)?;
let collection_type = self.collection.expected_type(context)?; let collection_type = self.collection.expected_type(context)?;
let item_type = if let Type::List(item_type) = collection_type { let item_type = if let Type::List(item_type) = collection_type {
item_type.as_ref().clone() item_type.as_ref().clone()
@ -79,6 +81,7 @@ impl AbstractTree for For {
self.context.inherit_all_from(context)?; self.context.inherit_all_from(context)?;
self.context.set_type(key, item_type)?; self.context.set_type(key, item_type)?;
self.item_id.validate(_source, &self.context)?;
self.block.validate(_source, &self.context) self.block.validate(_source, &self.context)
} }